i having these two annoying errors plz help me out how to fix these.
Warning: array_push() expects parameter 1 to be array, boolean given in D:\xampp\htdocs\simple_blog\inc\functions.inc.php on line 31
Warning: array_pop() expects parameter 1 to be array, boolean given in D:\xampp\htdocs\simple_blog\index.php on line 20
<?php
include_once 'inc/functions.inc.php';
include_once 'inc/db.inc.php';
$db = new PDO(DB_INFO,DB_USER,DB_PASS);
$id = (isset($_GET['id'])) ? (int) $_GET['id']:NULL;
$e = retrieveEntries($db,$id);
$fulldisp =array_pop($e);
$e =sanitizeData($e);
if ($fulldisp ==1)
{
?>
<h2> <?php echo $e['title']?></h2>
<p><?php echo $e['entry']?></p>
<?php }
?>
......
<?php
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;
}
function sanitizeData($data)
{
if(!is_array($data))
{
return strip_tags($data,"<a>");
}
else
{
array_map('sanitizeData',$data);
}
}
?>