Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySql DATE_FORMAT() issues

Status
Not open for further replies.

Deleted

Technical User
Jul 17, 2003
470
US
Got a problem with query output

my $query = "SELECT id, handle, DATE_FORMAT(insert_date, '%l:%i:%S %p') FROM session ORDER BY insert_date";
my $sth = $dbh->prepare($query);
$sth->execute;
my $data = $sth->fetchrow_hashref;

print "$data->{insert_date}";

The issue is that when I query the results as a hashref or arrayref_all the 'field name (insert_date)' returns a undef value.

Any suggestions?

 
Try
Code:
my $query = "SELECT id, handle, DATE_FORMAT(insert_date, '%l:%i:%S %p') [red]AS Fdate[/red] FROM session ORDER BY insert_date";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top