Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2
may sample code ba dito ng para sa news archives?? php & mysqli gamit ko.. di ko kasi mapalabas ung name ng month
ganito ung output
Archives
2014
1(1)
2(4)
3(3)
4(2)
5(1)
Dapat ganito
Archives
2014
January(1)
February(4)
March(3)
April(2)
May(1)
eto ung code ko..
Salamat sa tutulong
- - - Updated - - -
ito ilagay mo sa index.php file mo
may sample code ba dito ng para sa news archives?? php & mysqli gamit ko.. di ko kasi mapalabas ung name ng month
ganito ung output
Archives
2014
1(1)
2(4)
3(3)
4(2)
5(1)
Dapat ganito
Archives
2014
January(1)
February(4)
March(3)
April(2)
May(1)
eto ung code ko..
Code:
<?php
include("connection/connect.php");
$result=mysqli_query($con,"SELECT DISTINCT YEAR(post_date) AS myyear FROM posts");
while($fetch=mysqli_fetch_array($result)) {
echo "<b>".$fetch['myyear']."</b><br />";
$q1="SELECT MONTH(post_date) AS postmonth,count(*) AS postcount FROM posts WHERE year(post_date)=".$fetch['myyear']." GROUP BY MONTH(post_date)";
$temp1=mysqli_query($con,$q1);
while($temp=mysqli_fetch_array($temp1))
echo "<b>".$temp['postmonth']."</b> (".$temp['postcount'].")<br />";
}
mysqli_close($con);
?>
Salamat sa tutulong
- - - Updated - - -
Gawa ka ng index.php tpos dun sa loob nun lagyan mo ng code para maredirect yung site sa form.php mo i think heading yun eh. Di ko matandaan pero search m nlng yung code sa google.
ito ilagay mo sa index.php file mo
Code:
<?php
session_start();
if(!isset($_SESSION['username'])){
header("location: file na gusto mo maunang makita .php");
}
else {
?>