arn_php Posted August 23, 2008 Share Posted August 23, 2008 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. Quote Link to comment Share on other sites More sharing options...
marcus Posted August 23, 2008 Share Posted August 23, 2008 echo date("m d, Y",$time); Quote Link to comment Share on other sites More sharing options...
arn_php Posted August 23, 2008 Author Share Posted August 23, 2008 Thanks man, but isn't echo date("m d, Y",$time); would show the date today? I need to show the date from my mysql database, or do you mean echo date("m d, Y",$tgl); Quote Link to comment Share on other sites More sharing options...
marcus Posted August 23, 2008 Share Posted August 23, 2008 Well obviously my $time variable was in reference to yours, so yes. Quote Link to comment Share on other sites More sharing options...
arn_php Posted August 23, 2008 Author Share Posted August 23, 2008 Sorry man, I put echo 'Date: '.date("M d, Y",$tgl).' ';, then this is the date I got : Date : Dec 31, 1969 which is far away from my actual data date which is Aug 11, 08 (the Mysql shows it as 1218430800). Quote Link to comment Share on other sites More sharing options...
marcus Posted August 23, 2008 Share Posted August 23, 2008 <?php echo date("m d y",1218430800); ?> I get 08 11 08 Quote Link to comment Share on other sites More sharing options...
arn_php Posted August 23, 2008 Author Share Posted August 23, 2008 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? Quote Link to comment Share on other sites More sharing options...
marcus Posted August 23, 2008 Share Posted August 23, 2008 $tgl is never defined. Quote Link to comment Share on other sites More sharing options...
arn_php Posted August 23, 2008 Author Share Posted August 23, 2008 Please be more specific as it is all confusing to me. Thanks Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 23, 2008 Share Posted August 23, 2008 <?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. Quote Link to comment Share on other sites More sharing options...
arn_php Posted August 23, 2008 Author Share Posted August 23, 2008 Wow! that's it!! Quote Link to comment Share on other sites More sharing options...
arn_php Posted August 23, 2008 Author Share Posted August 23, 2008 Thanks man! (how do I mark this post as it is SOLVED?) Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 23, 2008 Share Posted August 23, 2008 Bottom left of the page, down near Jump To. You'll find it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.