Re: need help
| From: | 1LT John W. Holmes | Date: | Tue, 08 Oct 2002 16:57:03 +0000 |
| Subject: | Re: need help | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22275@lists.php.net to get a copy of this message | ||
Remove all of the @ for one, so you can see if there are any errors. You're
using $rs as two different variables, also. Check mysql_error() after your
query to see if an error is returned.
---John Holmes...
----- Original Message -----
From: "Frederick Belfon" <belly@softhome.net>
To: <php-db@lists.php.net>
Sent: Tuesday, October 08, 2002 12:19 PM
Subject: [PHP-DB] need help
I have Mysql set up on the same machine as the apache server. There is a
database name inventory_db with a table product_info which have the two row
id and name. I know there are three records in the table. However when ever
I place this script below into a webpage I get just a blank page. What can
I do to correct it. Thank you
<? php
# connect to mysql
$conn= @mysql_connect("localhost", "root")
or die ("Err:conn");
#select the specified database
$rs= @mysql_select_db("inventory_db", $conn)
or die("Err:Db");
#Create the query
$sql= "select id, name from product_info";
#execute the query
$rs= mysql_query($sql, $conn);
#write the data
while ($row=mysql_fetch_array($rs) )
{
echo("Product ID: " .$row["id"]);
echo(" Product Name: " .$row["name"] "<br>");
}
?>
/*" The gospel is meant to comfort the afflicted and afflict the
comfortable."
Garrison Keillor*/