Forum Moderators: coopster

Message Too Old, No Replies

Resource id #3

pull out data from table

         

sqlnew

5:43 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



Hello, all
I am trying to pull out data from my table. I know there are some records there, but when I tried the following code:

$query = "SELECT * FROM logpage WHERE user = '$user_name'";
$result = mysql_query($query);
echo "result is ", $result, "<br>";

I got "result is Resource id #3".

Anybody met such kind of situation before?
Any suggestion will be appreciated very much.

jatar_k

5:57 pm on Sep 21, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



we all have

that is the correct value of $result, mysql_query [php.net] returns a resource [php.net].

You need to do something with it to get at the data

you could use
mysql_fetch_array [php.net] to loop through the results
mysql_num_rows [php.net] to get the number of rows returned

sqlnew

6:12 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



Thank you very much. I thought mysql_query() gave TRUE or FALSE. I am new to PHP/MySQL. I should have read mysql_query() very carefully.
Thanks again.