MySQL Forums
Forum List  »  PHP

Re: date_format problem
Posted by: Jonathan Stephens
Date: May 09, 2005 07:33AM

> $story_id = "<id>$row[story_id]</id>";
> $date = "<date>$row[date]</date>";

You really should be using

$story_id = "<id>{$row['story_id']}</id>";
$date = "<date>{$row['date']}</date>";
[etc]

or better yet, use this and sidestep the quoting issue altogether:

$row = mysql_fetch_object($result);
$story_id = "<id>$row->story_id</id>";
$date = "<date>$row->date</date>";
[etc]

Please see "Why is $foo[bar] wrong?" on http://www.php.net/types.array to understand why.

Jon Stephens
MySQL Documentation Team @ Oracle

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Written By
Posted
May 08, 2005 08:19PM
May 09, 2005 04:29AM
Re: date_format problem
May 09, 2005 07:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.