Reply
PHP script outputting table row more than once
Old 04-27-2008, 10:12 AM PHP script outputting table row more than once
andyp's Avatar
Extreme Talker

Posts: 163
Name: andy patterson
I have a php script that keeps outputting the same row more than 100 times! I really dont know how this is happening so hopefully you guys will know and tell me
PHP Code:
while($post mysql_fetch_array(mysql_query("select * from table_posts where topic='$id'")))
{
    echo(
$post['body']);
    echo(
$post['userid']);
    echo(
$post['date']);
    echo(
"<br/>");

__________________
My webmaster news & tips blogs with free scripts and tutorials - http://ap-gfx.com
andyp is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-27-2008, 12:25 PM Re: PHP script outputting table row more than once
King Spam Talker

Posts: 1,048
Where does the variable '$id' get it's value and is that value unique for each record?

You may need to show a larger slice of the script before anyone can help you.

colbyt is offline
Reply With Quote
View Public Profile
 
Old 04-27-2008, 01:19 PM Re: PHP script outputting table row more than once
Skilled Talker

Posts: 83
I would output $id and see if it's actually what it's supposed to be. And you might wanna try mysql_fetch_assoc() instead of _array, because I was having a problem like this using _array(), and switching to _assoc() fixed it.
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 04-27-2008, 06:42 PM Re: PHP script outputting table row more than once
andyp's Avatar
Extreme Talker

Posts: 163
Name: andy patterson
Ok I'll try your idea kbfirebreather, it seems good. And the variable $id is just $id=$_GET['id'];
__________________
My webmaster news & tips blogs with free scripts and tutorials - http://ap-gfx.com
andyp is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP script outputting table row more than once
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11973 seconds with 13 queries