Re: MySQL and datatime field and displaying on page

From: Date: Fri, 21 Jun 2002 14:58:13 +0000
Subject: Re: MySQL and datatime field and displaying on page
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19958@lists.php.net to get a copy of this message
On Friday 21 June 2002 21:42, Charlie Grosvenor wrote: > Hi > I have a mysql table that has a field in it called 'DATETIMEADDED' > which has data type 'datetime' I want to display the contents of the field > on my page. I have tried usng the following code but the value in the > 'DATETIMEADDED' only the value in the 'NAME' field which is a varchar is > displayed on the page. How can i get it to display the value in > 'DATETIMEADDED'? > > <ul> > <? > $query = "SELECT * FROM BOARDITEMS WHERE > BOARDID=$BOARDID ORDER > BY 'DATETIMEADDED';"; The above should NOT have a semi-colon at the end. Assuming that this is the problem I don't see how you can display the value of the NAME field as your query is invalid and should not return any results. If that's not the problem then ... > $resultboarditems = mysql_query ($query) or die("Invalid Result > Set"); > while ($row = mysql_fetch_array ($resultboarditems)) { > ?> > <li><? echo $row["DATETIMEADDED"]; ?><? echo > $row["NAME"]; ?></li> do print_r($row); to see what it contains. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* It'll be just like Beggars' Canyon back home. -- Luke Skywalker */

« previous php.db (#19958) next »