# MySQL Error

**URL:** <https://forum.kirupa.com/t/mysql-error/227160>\
**Category:** programming\
**Created:** [May 27, 2007, 11:28pm UTC](https://forum.kirupa.com/t/mysql-error/227160 "2007-05-27T23:28:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flash\_Man1](https://avatars.discourse-cdn.com/v4/letter/f/8797f3/32.png) [@Flash\_Man1](https://forum.kirupa.com/u/Flash_Man1)\
**Post date:** [May 27, 2007, 11:28pm UTC](https://forum.kirupa.com/t/mysql-error/227160/1 "2007-05-27T23:28:36Z")

</div>

Hey all,

just got a little prob which is absolutely buggin me i can’t find this simple error…i’m going blind because i tested it it worked fine…couple hours later tested again (nothing changed) and i get this error now:

**Warning** : mysql\_fetch\_assoc(): supplied argument is not a valid MySQL result resource in … on line 12

here is the php code:

```php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
</head>
<?php require_once('Connections/connect.php'); ?>
<?php
$sql = mysql_query("SELECT * FROM my_table ORDER BY RAND() LIMIT 20");
echo '<table width="571" height="248" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
    <tr>';
for($x=0; $r = mysql_fetch_assoc($sql); $x++){
    if($x == 4){
        echo ' </tr><tr>';
        $x=0;
    }

    echo ' <td width="137" align="center" class="style1">'.$r['words'].'</td>'."
";
}
echo ' </tr>
</table>';
?>

<body>

</body>
</html>

```

Cheers in advance :bounce:
