Jump to content

Archived

This topic is now archived and is closed to further replies.

jaymc

fetch row elements from an array

Recommended Posts

$x = mysql_query($z);

if $x is going to contain 5 rows of info, how can I check to see what the ID field is equal to of each row without doing a mysql_fetch_array/assoc

Share this post


Link to post
Share on other sites
You cant, As $x stores the result resource of the query ($z). It holds nothing else. In order get the information form the result resource you need to pass $x to another mysql_*() function to process the result resource.

Share this post


Link to post
Share on other sites
What other functions can I use, apart from assoc and array

They are conflicting with my script esecpaily if in a while loop

Share this post


Link to post
Share on other sites
What do you mean by [quote]They are conflicting with my script esecpaily if in a while loop[/quote]
Please post the source of your script.

Ken

Share this post


Link to post
Share on other sites
For the while to work I have to run the same query twice

$runquerya = mysql_query($querya);
$runqueryb = mysql_query($querya);

And use each in the 2 while loops

Share this post


Link to post
Share on other sites
Running the same query twice is ill advised as it is possible for information to change between the two instances and that could cause problems. You should run the query once then dump the values into an array.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.