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>"; } ?> Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.