Warning: mysql_fetch_array(): supplied argument is not a val
Posted: Thu Feb 04, 2010 1:21 pm
Hi im trying to code my website but each time i visit the page im getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in page.php on line 8.
So i added in "or die(mysql_error()" And now it is saying this:
Parse error: syntax error, unexpected '{' in page.php on line 8
I do not no what is wrong, please can you help me.
This is the code for the page that gives the error.
The code for mysql.php is (Login info changed):
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in page.php on line 8.
So i added in "or die(mysql_error()" And now it is saying this:
Parse error: syntax error, unexpected '{' in page.php on line 8
I do not no what is wrong, please can you help me.
This is the code for the page that gives the error.
Code: Select all
<?php
$session=session_id();
include('includes/mysql.php');
$sql="SELECT * FROM development";
$result=mysql_query($sql);
while($rows = mysql_fetch_array($result) or die(mysql_error())
{
echo "<div class=\"red\">".$rows['name']."</div><br />".$rows['message']."<br /><br /><br /><br />";
}
?>Code: Select all
<?php
$con = mysql_connect("localhost:3333","USER","PASSWORD");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_website", $con);
?>