RE: Querying MySQL database

From: Date: Tue, 09 Apr 2002 10:24:15 +0000
Subject: RE: Querying MySQL database
References: 1  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-9504@lists.php.net to get a copy of this message
for support questions, look at http://www.php.net/support.php in this particular case, though, you need to do mysql_fetch_array($result), which will return an array that contains the result of your query.. Best regards, Mitja -----Original Message----- From: Sarah Lindsay Spencer [mailto:sls99d@Cs.Nott.AC.UK] Sent: 9. april 2002 11:45 To: webmaster@php.net Subject: Querying MySQL database 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.

« previous php.mirrors (#9504) next »