artisticre Posted November 19, 2007 Share Posted November 19, 2007 I have pasted my code below. Can someone please let me know why it is echoing the data twice? <?php $db = mysql_connect("xxx", "xxx", "xxx"); mysql_select_db("xxx",$db); $result = mysql_query("SELECT * from coaching where title = '$TitleList'",$db); if ($myrow = mysql_fetch_array($result)) { do { echo ("<table border=0 align=center width='90%'> <tr> <td> </td> </tr> <tr> <td class=coachtitle>$myrow[1]</td> </tr> <tr> <td class=coach>$myrow[2]</td> </tr> "); } while ($myrow = mysql_fetch_array($result)); echo ("</table>\n"); } else { echo "<br><br><p align=center>There Are No Coaching At This Time!</p>"; echo "<br><br><p align=center>Check Back Soon!</p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/77991-duplicating-records/ Share on other sites More sharing options...
fenway Posted November 19, 2007 Share Posted November 19, 2007 Your if() is retrieving rows, then the do/while is retriving rows... don't do that. A simple while loop will suffice. Link to comment https://forums.phpfreaks.com/topic/77991-duplicating-records/#findComment-394749 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.