Databases :: MySql :: DATE_FORMAT problems |
|||
| By: Squibi |
Date: 17/03/2003 00:00:00 |
Points: 25 | Status: Answered Quality : Excellent |
|
Hi, I am curious as to whats happening with this code. Every time I run it no results are returned. Any format problems anyone can see? $date = "SELECT DATE_FORMAT(move_in, '%m %d %y') FROM ilive.pri_listings WHERE listing_id = ".$listing_id; $date2 = mysql_query($date); $date3 = mysql_fetch_array($date2); echo "<font face = 'arial' size = '2' color = '#0000FF'><b>Available (mm/dd/yy):</b></font><font face = 'arial' size = '2'> ".$date3['move_in']."</font>"; Is there any obvious errors anyone can see? Thanks |
|||
| By: Squibi | Date: 17/03/2003 19:10:00 | Type : Comment |
|
| Never Mind, Figured it out, echo $date3[0]; Worked Whoever responds the quickest can have these points :) |
|||
| By: VGR | Date: 17/03/2003 19:20:00 | Type : Answer |
|
| yes, the story is that your column is not named 'move_in' but 'DATE_FORMAT(move_in, '%m %d %y') ' - always try first in the mySql console to see this kind of stupid mistake. You should take the habit of naminf your computed cilumns, like in here : $date = "SELECT DATE_FORMAT(move_in, '%m %d %y') AS a FROM ilive.pri_listings WHERE listing_id = ".$listing_id; echo "<font [...] ".$date3['a']."</font>"; |
|||
| By: Squibi | Date: 17/03/2003 19:23:00 | Type : Comment |
|
| Excellent tip, I wasn't aware of the AS notation |
|||
| By: VGR | Date: 17/03/2003 19:58:00 | Type : Comment |
|
| I wanted to merit the points ;-) |
|||
|
Do register to be able to answer |
|||
©2012 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








