can connect but error in retrieving data from mysql database
| From: | Scott | Date: | Thu, 25 Jan 2001 03:02:18 +0000 |
| Subject: | can connect but error in retrieving data from mysql database | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6154@lists.php.net to get a copy of this message | ||
Hi,
I have mysql, apache and php on my redhat 7 box and when I try to retrieve some
data from the database and display it on a webage, it doesn't display anything.
I seem to be able to connect to it fine but not pull any data. Here is the main
part of the code I am using:
<html>
<head>
<title> #### This is a PHP test #### </title>
</head>
<body bgcolor="blue">
<?php
//db_connect.php
include "common_db.inc";
error_reporting(1);
$link_id = db_connect("phptest");
if (!$link_id) {
die (sql_error());
}
else echo "Successfully made a connection to $dbhost using $default_dbname . <br>";
if (!$result=mysql_query("select * from user",$link_id)) {
echo "No! I selected nada from the user table";
}
else echo "Yes I can connect! Amen!";
?>
</body>
</html>
Basically what happens is I get the message saying that I successfully
connected to the database and then underneath I get the "No! I selected
nada..." message. Could someone point me in the right direction?
Thanks,
Scott