I'm having trouble pulling info from a database. I'm not sure if the problem is with my query or when I print it out. When I test the page this is what I get:
the product name isResource id #3
Resource id #4
Here is my code:
<?php // Script 8.4 - products.php
// error handling
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
// Connect and Select
if ($dbc = @mysql_connect ('localhost', 'xxxx', 'xxxx')) {
if (!@mysql_select_db ('xxxx')) {
die ('<p>Could not select the database because:' . mysql_error() . '</p>');
}
} else {
die ('<p>Could not connect to MySQL because: <b>' . mysql_error() . '</b></p>');
}
// Define the queries.
$namequery = 'SELECT name FROM productinfo WHERE (productid="4001")';
$basequery = 'SELECT base_price FROM productinfo WHERE (productid="4001")';
// Run the queries
$thename = mysql_query ($namequery);
$base = mysql_query ($basequery);
// print results
print ('the product name is' . $thename . '<br>' . $base);
mysql_close();
?>
Any help would be great.
Thanks
Bill