iceblox Posted October 30, 2007 Share Posted October 30, 2007 HI Guys, I have a simple echo query what i need it to do is on the last row not to print the "|" Seperator as in my ajax query im getting a blank option. Can someone help me with this please? <?php $query = "SELECT * FROM deals WHERE MakeName = '$id' GROUP BY ModelName ORDER BY ModelName ASC"; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)) { echo '' . $row[10] . ',' . $row[12] . '|'; } } else { echo ''; } ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/75378-solved-simple-echo-help/ Share on other sites More sharing options...
Orio Posted October 30, 2007 Share Posted October 30, 2007 You can change the while loop into something like this: <?php $row = mysql_fetch_row($result); while($row !== FALSE) { echo '' . $row[10] . ',' . $row[12]; $row = mysql_fetch_row($result); if($row !== FALSE) echo "|"; } ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/75378-solved-simple-echo-help/#findComment-381284 Share on other sites More sharing options...
iceblox Posted October 30, 2007 Author Share Posted October 30, 2007 Thanks Orio Worked a treat ;o) Quote Link to comment https://forums.phpfreaks.com/topic/75378-solved-simple-echo-help/#findComment-381309 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.