Mysql query

$rs=mysql_query("select * from mst_question where test_id=$tid AND status=0") ;
echo $rs ;

here is what I got:
Resource id #6

and

$query = " mysql_query(SELECT que_id,que_desc,ans1,ans2,ans3,ans4,true_ans FROM mst_question where ColId ='$sql)";
echo $query;

and here is what I got:
Resource id #5

all the variable in the select query are present.
what does this mean? Why there is difference? Thanks!

Can I ask what the question is you’d like answering?

Yeah, and you echo’d the value of $query instead of sending query into mysql_fetch_results($query), which would actually return the data. So what you are seeing is the resource PHP is holding that data in.

Second code example doesn’t run the query, just assigns a string called $query. I’m surprised the second one gives you the results you describe.

except that the command itself was deleted from PHP back in December last year. That code will only work with old versions of PHP that will soon no longer exist.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.