Mysql error?!
Posted: Sun Mar 30, 2008 3:42 pm
I have the following
It is giving me the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
I know that the SQL Statement is correct since i pasted it in the phpMyAdmin and gives the results.
Anybody know what i am doing wrong?
Thanks
Code: Select all
function GetContent($strPageName){
global $dbConnection;
$strSqlStatement = "SELECT * FROM tblContent WHERE PageName="."'".$strPageName."'";
echo $strSqlStatement;
$result = mysql_query($strSqlStatement);
if(!result){
die("Database query failed".mysql_error());
}
return result;
}
<?php
$pageName = $_GET["PageName"];
if($pageName != NULL){
$result = GetContent($pageName);
if($result != NULL){
while($content = mysql_fetch_array($result)){
echo "{$content['Content]}";
}
}
}
?>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in
I know that the SQL Statement is correct since i pasted it in the phpMyAdmin and gives the results.
Anybody know what i am doing wrong?
Thanks