Querying MySQL database
| From: | Sarah Lindsay Spencer | Date: | Tue, 09 Apr 2002 09:45:25 +0000 |
| Subject: | Querying MySQL database | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-9503@lists.php.net to get a copy of this message | ||
Hello, I'm not sure if you're the person I want to be asking, but I am
really stuck trying to do a simple query to my database. I am connected
to the database, and as far as I can see the following code should work:
<?
$db = mysql_connect("mysql.cs.nott.ac.uk", "sls99d", "sls4681");
if (!$db)
{
echo "<p>Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("sls99d");
$query = "select Question
from Questions
where Question_no = 'Q1'";
$result = mysql_query( $query );
$num_results = mysql_num_rows($result);
echo "$result";
Require("Footer2.php");
?>
On the web page it echoes: 'Resource #2', which is not part of my
database and is not what is supposed to be echoed.
Please could you help me, or advise me where to go for this help.
Thank you, Sarah.