i am trying to display a couple of records with php and mysql, and i want 'vs' in the middle of the two records
eg.
Record1 vs Record2
but when i try to do this i get
Record1 vs Record2 vs
using this code
<?
$sql = "SELECT DISTINCT match_id FROM `match` where event='monday'";
$query = mysql_query($sql) or die (mysql_error());
while ($m_m=mysql_fetch_array($query)) {
$sql2 = "SELECT * FROM `match` WHERE match_id='".$m_m['match_id']."'";
$query2 = mysql_query($sql2) or die (mysql_error());
while ($m_m2=mysql_fetch_array($query2)) {
$wid = $m_m2['wid'];
$sql3 = "SELECT w_name FROM roster where id='$wid'";
$query3 = mysql_query($sql3) or die (mysql_error());
while ($m_m3=mysql_fetch_array($query3)) {
echo $m_m3['w_name']." vs";
}
}
}
?>
i know this is because of the while statement and i could fix this by using a for() statement but i cant quite figure out how
could someone please help?!
thanks 🙂