$e = retrieveEntries($db,$id);
i m passing db connection and entry id to function and function returning mein one when i check with print_r
$e is not returning please help me out
here is the function
function retrieveEntries($db,$id=NULL)
{
if(isset($id))
{
$sql ="SELECT title,entry FROM entries WHERE id =? LIMIT =1";
$stmt=$db->prepare($sql);
$stmt->execute(array($_GET['id']));
$e=$stmt->fetch();
$fulldisp=1;
}
else
{
$sql="Select id,title From entries ORDER BY created DESC";
foreach ($db->query($sql) as $row)
{
$e[] =array($row['id'],$row['title']);
}
$fulldisp = 0;
if(!is_array($e))
{
$fulldisp =1;
$e = array('title'=>'No Entrie Yet',
'entry'=>'<a href="/admin.php">Post an entry!</a>'
);
}
}
array_push($e, $fulldisp);
return $e;
}