0

I’m starting with WordPress and I have a lot of problems and doubts.

I’m trying to display on a page data stored in a table of my database.

I have a table named Customers (id, name, surname, phone). Im adding code to the main page of the website:

[php]

$idCon = mysql_connect('localhost','user','password');

if(!$idCon){ echo "Error connecting database."; exit; }

mysql_select_db("database",$idCon); $query = "SELECT * FROM CUSTOMERS"; global $respuesta = $wpdb->get_results($query);

foreach( $respuesta as $row ) {

    echo $row->nombre;
}

$reg = mysql_fetch_row($res); mysql_close($idConn);

[/php]

But nothing is displayed in the page. Can you help me?

By the way, how can i debug code in wordpress ? That should help me a lot.

Thanks

  • 1
    It seems you have custom table added and without more information helping you would be difficult. Please check How to ask and what not to ask. Now please edit the question accordingly for seeking help from the community. – Maruti Mohanty Dec 11 '13 at 11:31
  • 1
    It's not clear fron your question if you have any level of proficiency with PHP as well. You are unlikely to just get ready-made solution as an answer. – Rarst Dec 11 '13 at 14:14
-1

Maybe you find solution here: Wordpress Codex wpdb

Best regards!

  • 1
    Please do not answer with links only, add an explanation and possibly code. – Nicolai Dec 12 '13 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.