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); ?> Link to comment https://forums.phpfreaks.com/topic/229403-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/ Share on other sites More sharing options...
Rifts Posted March 2, 2011 Share Posted March 2, 2011 can you post what $Link value is. Link to comment https://forums.phpfreaks.com/topic/229403-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1181966 Share on other sites More sharing options...
fabiez Posted March 2, 2011 Author Share Posted March 2, 2011 mysql_connect Link to comment https://forums.phpfreaks.com/topic/229403-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1181969 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 Link to comment https://forums.phpfreaks.com/topic/229403-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1181970 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()); Link to comment https://forums.phpfreaks.com/topic/229403-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1181972 Share on other sites More sharing options...
fabiez Posted March 2, 2011 Author Share Posted March 2, 2011 thanks Link to comment https://forums.phpfreaks.com/topic/229403-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-i/#findComment-1181977 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.