timestamp manipulate with php

Hey Guys, im fairly new to PhP so i dont really know how to type variables, ive been editing php code, but don’t really know how it all works yet. Im stuck with timestamp(database) to php date manipulation if thats the right terms which it probably isnt. Anyway ive found a code to manipulate timestamp with php and i tested it on a blank page and the date displays perfectly for each record from the data base and i can also change the format to D, M, Y and so forth. Im trying to get this exact output in a html table column, every time i try to edit the code and try something new it never seems to work quite right, most of the time i get a 1970 date on all records, or it will pull a date from 1 individual record and display that date for all the records.

I need this[php]

<?php echo $f5; ?>[/php]
[hr]
to pick up this date format with echo, cause it seems as long as echo is in front of date it will work perfectly[php]echo date("g:i a F j, Y ", strtotime($row[“time”]));[/php]

Help would be greatly appreciated i just hope i explained it clear enough as i am not well schooled in php thanks

[php]<?php
$i=0;
while ($i < $num) {

$f2=mysql_result($result,$i,“firstname”);

$f3=mysql_result($result,$i,“country”);

$f4=mysql_result($result,$i,“healingrequest”);

mysql_connect(“localhost”, “root”, “alchemy10”) or die(mysql_error());

mysql_select_db(“angel208_form”) or die(mysql_error());

$result1 = mysql_query(“SELECT time FROM lightable;”);
while ( $row = mysql_fetch_array($result1) ) {

echo date("g:i a F j, Y ", strtotime($row[“time”]));

}
?>

<?php echo $f2; ?> <?php echo $f3; ?> <?php echo $f4; ?> <?php echo $f5; ?> <?php $i++; } ?>[/php]

Ive tried this as a Variable
[PHP]$f5 = date("g:i a F j, Y ", strtotime($row[“time”]));[/PHP]

with this table code
[PHP]

<?php echo $f5; ?>[/PHP]

I get the proper date format

11:13 am October 7, 2011

for each record the timestamp is the same 11:13 am October 7, 2011 in the php file table, when i check the mysql database the timestamps are all different. It seems that this date 11:13 am October 7, 2011 is being pulled from one of the records in the database and assigning it to all the records in the php file table. What am i doing wrong?

Sponsor our Newsletter | Privacy Policy | Terms of Service