Jump to content

[SOLVED] showing date from mysql


arn_php

Recommended Posts

I have a table within the mysql that has a date entry.  I would like to show it on the webpage using this code: '.stripslashes($row['tgl']).' tgl here is the date data.  The date data is actually : 08-11-2008 but then into my web page, it shows: 1218430800. What is wrong with my code?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/120954-solved-showing-date-from-mysql/
Share on other sites

You are right! uh.. what's wrong with me? here is the whole code:

<?php

$query="SELECT * FROM arnold_next_meeting WHERE flag_status ='1'";

$result=mysql_query($query);

while($row=mysql_fetch_array($result))

{

echo '<ul>

<li>Date : <b>'.date("M d, Y",$tgl).'</b></li>

<li>Place : <b>'.stripslashes($row['place']).'</b></li>

}

?>

 

Why does it shows the  Date : Dec 31, 1969 ?  Am I putting this wrong?

<?php
$query="SELECT * FROM arnold_next_meeting WHERE flag_status ='1'";
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
echo '<ul>
     <li>Date : '.date("M d, Y",$row['tgl']).'</li>
     <li>Place : '.stripslashes($row['place']).'</li>
}
?>

 

You haven't set $tgl, so I assumed it was a row in your database.

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.