Duplicate results

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Perfidus
Forum Contributor
Posts: 114
Joined: Sun Nov 02, 2003 9:54 pm

Duplicate results

Post by Perfidus »

The following query:

$getiplist = mysql_query($questions, $link)or die(mysql_error());
$numofips = mysql_num_rows($getiplist);

Gaves me a result of 21.

If I echo the results:

while($row = mysql_fetch_array($getiplist))
{
foreach($row as $column)
echo $row['e_mail_rest']."<br>";}

I get 42 results, each result is being duplicated so I get each twice.
I'm trying to see where am I stumbling but I do not get it.
Where's the stupid mistake?
User avatar
potsed
Forum Commoner
Posts: 50
Joined: Sat Oct 09, 2004 12:00 pm
Location: - South Africa

Post by potsed »

why do you have the foreach u r already looping through the results with the while

Code: Select all

while($row = mysql_fetch_array($getiplist)) { 
    echo $row['e_mail_rest']."<br>";
}
And may i ask why have you posted this question twice??
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Lol i was thinking in my head, where the hell did my post go :P
Post Reply