Jump to content

Recommended Posts

is there a way to retreave all the data from a set user in a table?

Im querying select username from users_table were userid = '$userid'

then im using mysql_fetch_row($results);

I believe this only brings the one row though

and i want to bring more then one row back from the db

I have managed to do it,

I called all the data from the table then looped through taking out what i wanted
but I just wonderd if there was a better way?

I have only been playing with mysql for a couple of days and realy have no idea what can and cant be done
[!--quoteo(post=384359:date=Jun 15 2006, 09:42 PM:name=thehigherentity)--][div class=\'quotetop\']QUOTE(thehigherentity @ Jun 15 2006, 09:42 PM) [snapback]384359[/snapback][/div][div class=\'quotemain\'][!--quotec--]
is there a way to retreave all the data from a set user in a table?

Im querying select username from users_table were userid = '$userid'

then im using mysql_fetch_row($results);

I believe this only brings the one row though

and i want to bring more then one row back from the db

I have managed to do it,

I called all the data from the table then looped through taking out what i wanted
but I just wonderd if there was a better way?

I have only been playing with mysql for a couple of days and realy have no idea what can and cant be done
[/quote]

This code will cycle through all of the results returned from the query then you do whatever you like with the results for example put them in an array or draw a HTML table.

[code]
while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
     extract($row);

     // Insert your code here
}
[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.