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" <[EMAIL PROTECTED]>
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
Garrison Keillor*/

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to