RE: [PHP-WIN] dates
| From: | Rich Gray | Date: | Fri, 04 Oct 2002 13:46:51 +0000 |
| Subject: | RE: [PHP-WIN] dates | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16163@lists.php.net to get a copy of this message | ||
Tim
In your select statment you have labeled the returned column as date yet
your mysql_fetch_array uses the label 'tutdate' - the labels don't match...
To fix it, either do this...
$query = "SELECT DATE_FORMAT(tutdate, '%b-%e %l%p') as tutdate FROM
tutorial_table";
or do this ...
$vardate = stripslashes($row['date']);
HTH
Rich
-----Original Message-----
From: Tim Blackwell [mailto:timblackwell@hotmail.com]
Sent: 04 October 2002 14:12
To: php-windows@lists.php.net
Subject: [PHP-WIN] dates
any reason why my echo statement doesn't work in this script?
<?
mysql_select_db("tutorial");
$query = "SELECT DATE_FORMAT(tutdate, '%b-%e %l%p') as date FROM
tutorial_table";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$vardate = stripslashes($row["tutdate"]);
echo "$vardate";
}
?>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php