Jump to content

Problem in Displaying records


max_w1

Recommended Posts

hi,

i am trying to display recrods in a php page with a query like this:

 

$fighter = mysql_query ("SELECT `abc` 
FROM `tablename` 
WHERE`username` LIKE '$username'
LIMIT 0 , 30") or die(mysql_error());
 $myfighter = mysql_fetch_assoc($fighter);
echo "$myfighter['f_id']";

 

but it is displaying only one record how do id display all records which match this condition.

can anyone tell me how to display all records at once

Link to comment
Share on other sites

i am really upset with you guys >:(

 

i finally found the answer myself.

what i did is:

$result = mysql_query ("SELECT `abc` 
FROM `tablename` 
WHERE`username` LIKE '$username'
LIMIT 0 , 30") or die(mysql_error());
  $myresult = mysql_fetch_assoc($result);
while($myresult = mysql_fetch_assoc($result))
{
echo $myresult['f_id'];
}

KEEP UP THE GOOD WORK OF NOT HELPING!!!! :(>:( >:(

Link to comment
Share on other sites

It's Sunday in most of the time zones on earth right now, so the number of people even reading posts is very low. You need to have enough patients to wait at least two hours from your original post for a reply.

 

Looping is a fundamental concept in all programming languages. Anyone who did read your post probably expected you to be able to figure out what the problem was.

 

Your final code will end up with one missing row of data because you are fetching an extra row in the line of code before your loop.

Link to comment
Share on other sites

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.