fabiez Posted March 2, 2011 Share Posted March 2, 2011 I can't find what's wrong with the code... <?php $Sql = "select team1, team2, t1outcome, t2outcome, winner from coupons where user='$User'"; $Result = mysql_query($Sql, $Link); print "<table cellpadding=0 cellspacing=0 border=0>"; print "<tr>"; print "<td align=left valign=top> </td>"; print "<td align=left valign=top> </td>"; print "</tr>"; while($Row = mysql_fetch_array($Result)){ if($Row[team1] == $Row[winner]){ print "<tr>"; print "<td align=left valign=top> </td>"; print "<td align=left valign=top><bold>$Row[team1]</bold> - $Row[team2] $Row[t1outcome]-$Row[t2outcome]</td>"; print "</tr>"; } else { print "<tr>"; print "<td align=left valign=top> </td>"; print "<td align=left valign=top>$Row[team1] - $Row[team2] $Row[t1outcome]-$Row[t2outcome]</td>"; print "</tr>"; } } print "</table>"; mysql_close($Link); ?> Quote Link to comment Share on other sites More sharing options...
Rifts Posted March 2, 2011 Share Posted March 2, 2011 can you post what $Link value is. Quote Link to comment Share on other sites More sharing options...
fabiez Posted March 2, 2011 Author Share Posted March 2, 2011 mysql_connect Quote Link to comment Share on other sites More sharing options...
Rifts Posted March 2, 2011 Share Posted March 2, 2011 try this <?php mysql_connect('yourserver', 'login', 'password') or die('Can not connect 1'); mysql_select_db('yourdatabase') or die('Can not connect 2'); $sql = mysql_query("select team1, team2, t1outcome, t2outcome, winner from coupons where user='$User'"); print "<table cellpadding=0 cellspacing=0 border=0>"; print "<tr>"; print "<td align=left valign=top> </td>"; print "<td align=left valign=top> </td>"; print "</tr>"; while($Row = mysql_fetch_array($sql)){ if($Row[team1] == $Row[winner]){ print "<tr>"; print "<td align=left valign=top> </td>"; print "<td align=left valign=top><bold>$Row[team1]</bold> - $Row[team2] $Row[t1outcome]-$Row[t2outcome]</td>"; print "</tr>"; } else { print "<tr>"; print "<td align=left valign=top> </td>"; print "<td align=left valign=top>$Row[team1] - $Row[team2] $Row[t1outcome]-$Row[t2outcome]</td>"; print "</tr>"; } } print "</table>"; mysql_close($Link); ?> just change out the info with yours Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 2, 2011 Share Posted March 2, 2011 Your query is failing due to one of about a dozen possible reasons. Use mysql_error() to find out why - $Result = mysql_query($Sql, $Link) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
fabiez Posted March 2, 2011 Author Share Posted March 2, 2011 thanks 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.