PHP and MySql getting the month name

I have a MySQL database that contains a date field named TripDate.
I want to have it give me the name and number of the month, preferably in
two different variables.
How do I do this?

$query="SELECT TripDate
FROM SCBoatTrips WHERE TripDate > '$Today'
ORDER BY TripDate";

while ($row = mysql_fetch_array($result))
{
Print("$row[0]<br>");
}
Kevin Marks [ Sa, 14 April 2007 15:24 ] [ ID #1687742 ]

Re: PHP and MySql getting the month name

"Kevin Marks" <kevin [at] westportwa.com> wrote in message
news:CqCdnTH2genfS73bnZ2dnUVZ_s-rnZ2d [at] comcast.com...
|I have a MySQL database that contains a date field named TripDate.
| I want to have it give me the name and number of the month, preferably in
| two different variables.
| How do I do this?
|
| $query="SELECT TripDate
| FROM SCBoatTrips WHERE TripDate > '$Today'
| ORDER BY TripDate";
|
| while ($row = mysql_fetch_array($result))
| {
| Print("$row[0]<br>");
| }

it depends on whether or not you want to do it in the query or by using php
on the data after the query is run. based on that decision, RTCFM (where 'c'
== 'correct')!!!
Steve [ Sa, 14 April 2007 17:42 ] [ ID #1687744 ]

Re: PHP and MySql getting the month name

I am trying to do it in PHP, not in the query.

"Steve" <no.one [at] example.com> wrote in message
news:QB6Uh.7$B42.1 [at] newsfe02.lga...
>
> "Kevin Marks" <kevin [at] westportwa.com> wrote in message
> news:CqCdnTH2genfS73bnZ2dnUVZ_s-rnZ2d [at] comcast.com...
> |I have a MySQL database that contains a date field named TripDate.
> | I want to have it give me the name and number of the month, preferably
> in
> | two different variables.
> | How do I do this?
> |
> | $query="SELECT TripDate
> | FROM SCBoatTrips WHERE TripDate > '$Today'
> | ORDER BY TripDate";
> |
> | while ($row = mysql_fetch_array($result))
> | {
> | Print("$row[0]<br>");
> | }
>
> it depends on whether or not you want to do it in the query or by using
> php
> on the data after the query is run. based on that decision, RTCFM (where
> 'c'
> == 'correct')!!!
>
>
Kevin Marks [ Sa, 14 April 2007 18:14 ] [ ID #1687747 ]

Re: PHP and MySql getting the month name

date(format, strtotime(yourtimecolumn))

it is far faster to do it in the query though.

i do hope you work on your inline sql format though.


"Kevin Marks" <kevin [at] westportwa.com> wrote in message
news:dtWdncDITvSDY73bnZ2dnUVZ_s6onZ2d [at] comcast.com...
|I am trying to do it in PHP, not in the query.
|
| "Steve" <no.one [at] example.com> wrote in message
| news:QB6Uh.7$B42.1 [at] newsfe02.lga...
| >
| > "Kevin Marks" <kevin [at] westportwa.com> wrote in message
| > news:CqCdnTH2genfS73bnZ2dnUVZ_s-rnZ2d [at] comcast.com...
| > |I have a MySQL database that contains a date field named TripDate.
| > | I want to have it give me the name and number of the month, preferably
| > in
| > | two different variables.
| > | How do I do this?
| > |
| > | $query="SELECT TripDate
| > | FROM SCBoatTrips WHERE TripDate > '$Today'
| > | ORDER BY TripDate";
| > |
| > | while ($row = mysql_fetch_array($result))
| > | {
| > | Print("$row[0]<br>");
| > | }
| >
| > it depends on whether or not you want to do it in the query or by using
| > php
| > on the data after the query is run. based on that decision, RTCFM (where
| > 'c'
| > == 'correct')!!!
| >
| >
|
|
Steve [ Sa, 14 April 2007 20:30 ] [ ID #1687751 ]
PHP » alt.php » PHP and MySql getting the month name

Vorheriges Thema: Checkstate of Radiobutton
Nächstes Thema: Re: Amazing eBay auction!