Jump to content

Count time() by months.


SeanHarding

Recommended Posts

I have created a Blog (very basic).

 

My problem is...

I have entries to my blog stored in mysqli, i have a column named 'time' which contains time().

In other words I have about 4 entries of 10 date characters...

 

I need to create a month archive displaying how many entries are in that post. e.g.

June08(2)

May08(3)

(Im going to link these later to display the containing posts).

Here is my code so far...

$quer = "SELECT * FROM blog ORDER BY time DESC";
$getr = mysqli_query($login, $quer);
while ($resr = mysqli_fetch_array($getr)) {
	$string = $resr['body'];
	$s_stri = substr($string, 0, 200);
	$date = date('g:iA d/m/y', $resr['time']);
	echo '<div class="post">'. $resr['title'] .'<div class="post_body">'. $s_stri .'<a href="Blog.php?blog='. $resr['id'] .'" title="Read On">... Read More</a>';
	echo '</div><div class="post_info"><div class="postedby">By: '. $resr['author'] .'</div><div class="timestamp">'. $date .'</div></div></div>';
	}

Sorry about my HTML formatting.

 

Help....

 

Link to comment
https://forums.phpfreaks.com/topic/130601-count-time-by-months/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.