Hello is there any body awake pleeeeeeeeeeeeeease 🙂 ...
got this error , I am trying to generate file name from an array ;;;
calling program:
<?php
require_once('lib/config.php');
$blog= new Blog();
?>
<div id="logo"><img src="image/banner2.jpg" alt="banner" /></div>
<div id="content">
<ul id="jsddm">
<li><a href="#">Archives</a>
<ul>
<?php
$monthsList = $blog->getMonthsWithArticlesList();
foreach ($monthsList as $month){
//print $month['date'];
echo '<li><a href="articles'.substr($month['date'],0,4).date( 'F', mktime(0, 0, 0, substr($month['date'],5,2) ) ).'.html">'.$month['date'].'</a></li>'."\n";}
?>
</ul>
</li>
<li><a href="#">Admin</a></li>
<li><a href="#">Subscribe</a></li>
</ul>
</div>
and this is the function generating the array :
function getMonthsWithArticlesList() {
$sql = "select date from article order by date desc";
$result = mysql_query($sql);
if (!$result) die('Invalid query: ' . mysql_error());
$dateList = array();
while ($row= mysql_fetch_assoc($result)) array_push($dateList,$row['date']);
//
// print_r($dateList);
$date2List = array();
foreach ($dateList as $date) {
$subDate = substr($date,0,7);
array_push($date2List,$subDate);
}
$date2List = array_unique($date2List);
// print_r($date2List);
$date3List = array();
foreach ($date2List as $date) {
$item = array("link" => $date,
"date" => substr($date,0,4) . " / " . date( 'F', mktime(0, 0, 0, substr($date,5,2) ) ) );
array_push($date3List,$item);
}
// print_r($date3List);
return $date3List;
}