Re: [phplib] value returned by $db->f From: Bob Bowker (bowker <email protected>)
Date: 05/06/01

Hi --

I spoke too quickly in my last message ...

$qry="SELECT DATE_FORMAT(field_containing_timestamp, 'format') as dt FROM
your_table");

$db->query("$qry");

$db->next_record();

$whatyouwant = $db->f("dt");

That should do it ...

Bob.

At 07:13 AM 5/6/01 -0400, you wrote:
>A problem does arise (and maybe this was what was alluded to by Peter
>Termaten <ptermaten <email protected>>) and that is the $db->f function can't deal
>with all the formatting stuff. So, if you do a query like:
>
>SELECT
> DATE_FORMAT(field_containing_timestamp, "%d-%c-%Y %T")
>FROM
> some_table
>
>How do you get the value from the $db->f function? You have to alias the
>calculated column. So, you would do something like:
>
>SELECT
> DATE_FORMAT(field_containing_timestamp, "%d-%c-%Y %T") AS date_string
>FROM
> some_table
>
>
>and then you can use the $db->f function like $db->f('date_string').
>--
>Jesse Swensen
>swensenj <email protected>
>
> > From: "nathan r. hruby" <nhruby <email protected>>
> > Date: Sat, 5 May 2001 16:01:52 -0500 (CDT)
> > To: Bob Bowker <bowker <email protected>>
> > Cc: Peter Termaten <ptermaten <email protected>>, <phplib <email protected>>
> > Subject: Re: [phplib] value returned by $db->f
> >
> > Another method is to just issue a query for the timestamp files with the
> > DATE_FORMAT string as part of the select statement.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: phplib-unsubscribe <email protected>
>For additional commands, e-mail: phplib-help <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>