Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given i


fabiez

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.