Hi all,
I've looked through this forum for some hours and am absolutely unable to fix my problem; no matter what I do.
I'm trying to pass a PHP variable as part of a MYSQL query like so:
$id = $_GET["bodyid"];
$blog = getEntries("SELECT `Articlebody` FROM `Blog` WHERE id ='$id'");
function getEntries($query) {
$connection = mysql_open();
echo $query;
$result = @ mysql_query($query, $connection)
or showerror();
$blog = array();
while ($row = mysql_fetch_array($result)) {
$blog[] = $row;
}
mysql_close($connection)
or showerror();
return $blog;
}
What is happening is that the query is returning no results because the variable is not being recognized for whatever reason.
The echo statement in the getEntries method is returning :
SELECT `Articlebody` FROM `Blog` WHERE id =''
Could somebody point me in the right direction?
Thanks.