Jump to content


Photo

fetch row elements from an array


  • Please log in to reply
6 replies to this topic

#1 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 21 October 2006 - 03:35 PM

$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


I would love to change the world, but they won't give me the source code

SEO Agency

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 21 October 2006 - 04:22 PM

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.

#3 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 21 October 2006 - 06:06 PM

What other functions can I use, apart from assoc and array

They are conflicting with my script esecpaily if in a while loop
I would love to change the world, but they won't give me the source code

SEO Agency

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 21 October 2006 - 06:07 PM

What do you mean by

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

Please post the source of your script.

Ken

#5 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 21 October 2006 - 06:36 PM

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
I would love to change the world, but they won't give me the source code

SEO Agency

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 21 October 2006 - 06:49 PM

Post your full code ok cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,891 posts
  • LocationCanada

Posted 21 October 2006 - 07:40 PM

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.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users