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