You are selecting it as date but trying to echo DateOfOrder Try this: $TheDate = mysql_query("select DATE_FORMAT(DateOfOrder, '%d, %m, %Y') as date from Orders Where Orders.ID = '$TransID'"); while($OrderDate = mysql_fetch_array($TheDate)) { $Date = $OrderDate["date"]; } -----Original Message----- From: Graeme McLaren [mailto:mickel@ntlworld.com] Sent: Sunday, October 26, 2003 4:22 PM To: php-db@lists.php.net Subject: Query works but can't echo variable :'( Hey everyone, the following query and code works fine but I can't understand why I can't echo the $Date variable. I guess it doesn't work fine then :( Any ideas ? G :) $TheDate = mysql_query("select DATE_FORMAT(DateOfOrder, '%d, %m, %Y') as date from Orders Where Orders.ID = '$TransID'"); while($OrderDate = mysql_fetch_array($TheDate)) { $Date = $OrderDate["DateOfOrder"]; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php