View Full Version : MySQL DATABASE ERROR?????

Tristan S.S.
02-18-2007, 06:41 PM

I am trying to design a page with the main content and sidebar dynamic with MySQL and PHP. The below code is what I use to connect and echo the contents (well except for my user,pass,db name etc).


$con = mysql_connect("mysql.server.com","joe","soap");
if (!$con)
die('Could not connect: ' . mysql_error());

mysql_select_db("my_database", $con);
$result = mysql_query("SELECT * FROM abc");
$row = mysql_fetch_array($result);

echo "This is: <br> ".$row['fld_Content']."<br>".$row['fld_Sidebar']." ";


However this error keeps coming up.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

Has this got something to do with the PHP.INI file ? Or something in my code?

// If it the php.ini file, how can i fix it?


02-18-2007, 08:56 PM
That error message has to do with the query to the database. Either the database "my_database" or the table in the database "abc" is none existant (spelling?) or there are no rows in the db for the fetch array to work.

Hope this helps.