<?php
//run a select query to my latest 1 item
include "storescripts/connect_to_mysql.php";
// This block grabs the whole list for viewing
$dynamicList= "";
$sql = mysql_query("SELECT * FROM blog");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$title = $row["title"];
$author = $row["author"];
$category = $row["category"];
$article = $row["article"];
// $postdate = strftime("%b %d, %Y", strtotime($row["postdate"]));
$postdate = $row["postdate"];
//Seperate so it's easier to see what i'm working with here.
$short = substr(strip_tags($article), 0, 400);
$dynamicList .= '<ul>
<li>
<div class="wrapFirstRowBlog">
<div class="postDate">'.$postdate.'</div>
<div class="nextToDate">
<div class="blogTitle"><h3><a href="blog.php?id='.$id.'">'.$title.'</a></h3></div>
<div class="author">written by '.$author.' for the '.$category.' section.</div>
<div class="socialNetwork"></div>
</div>
</div>
<div class="blogPreview">
<img class="blogLeft" src="../blog_images/'.$id.'.jpg" width="150" height"150" alt="'.$title.'"/>'.$short.'...<a href="http://www.moniquetrinidadjewelry.com/images/new-images/read-more.png"><img src="http://www.moniquetrinidadjewelry.com/images/new-images/read-more.png" alt="read more of this post" /></a>
</div>
</li>
</ul>';
}
} else {
$dynamicList = 'Nothing posted yet...check back soon!';
}
mysql_close();
?>
ここで検索された多くの組み合わせを試しましたが、スクリプト内で始めようとしていることができます。日付を単に日付を表示するように変換しようとしています。私のmysqlの読みは
2013-06-03 00:18:32
時間を省略して、日付のみを表示するようにしたいと思います。スクリプト内にある場合、それを行う方法がわかりません。私はもう試した
$postdate = strftime("%b %d, %Y", strtotime($row["postdate"]));
これは行の包含であり、それを把握できません。どの時点でこれらの変更を出力する必要があり、その理由についての参照をいただければ幸いです。