Designing and Development > Programming

what is Resource id #4 in mysql

(1/1)

rahul:
HI all,
              i make a query in sql like

--- Code: ---$query  = "SELECT * FROM users
WHERE id = 1";
$res = mysql_query($query);
echo $res;


--- End code ---

it shows Resource id #4 if i change id 1 to 100 mean empty result still this shows Resource id #4 can some one make me clear that what this Resource id in mysql and how to check $res is empty or not..

Thanks in Advance

Savera:
Resource is something like reference to result you received from mysql after query, so think it as location where result is saved by mysql after you ask for, now you have to go to that resource and get the information which we do using mysql_fetch_assoc() or similar..

rahul:
thanks for you reply

But there are only two records in my table how could be this possible to find 4 resources and some time i saw Resource  id #22 as well any other idea please help

Navigation

[0] Message Index

Go to full version