Re: [PHP] Re: mysql timestamp and php date

2002-09-30 Thread Bryan Koschmann - GKT

This is what I am using here:

$db = DB::connect("mysql://$username:$password@$hostName/$databaseName");

if (DB::iserror($db))
die($db->getMessage());

$sql = "SELECT idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %l:%i%p'),
news FROM newslist ORDER BY idnum DESC";

$query = $db->query($sql);
if (DB::iserror($query))
die($db->getMessage());

while ($query->fetchInto($row)) {
echo "\n" .
"\n\n\t$row[1] ID#$row[0]" .
"\n\n\tAdded $row[2]" .
"\n\n\t$row[3]" .
"\n";
}


I took out all the font formatting and stuff so its not so cluttered here.
but it works just dandy, although I know what you are talkng about, when
using the other way to connect it returns the name as whatever (like a
COUNT(*) does). Although, I never knew the AS var thing, so that will help
me with other stuff down the road!

I know this is nothing fancy, but it is just what I've been wanting to do
since before I started learning php and mysql. :)

Bryan

On Mon, 30 Sep 2002, Jason Young wrote:

|No  problem!
|
|Refresh MY memory here.. I noticed you didn't return the DATE_FORMAT
|column "AS " .. is that working okay? I seemed to think that it
|returned a long unwieldy column name.. maybe things are good.. let me
|know :-D
|
|--Jason
|


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: mysql timestamp and php date

2002-09-30 Thread Jason Young

No  problem!

Refresh MY memory here.. I noticed you didn't return the DATE_FORMAT 
column "AS " .. is that working okay? I seemed to think that it 
returned a long unwieldy column name.. maybe things are good.. let me 
know :-D

--Jason

Bryan Koschmann - Gkt wrote:
> Hi Jason,
> 
> I had come across this earlier, and while I can get it to return
> perfectly, I was more looking for something that I could do without having
> to pull 2 queries. Err, well wait, I wouldn't have to would I? I have 4
> columns:
> 
> idnum, title, date, news
> 
> I was just doing a select * from newlist, but I suppose I can just address
> each specifically:
> 
> select idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %h:%i%p'), news from
> newslist
> 
> right? Okay that works.
> 
> (don't mind me talking to myself)
> 
> Thanks for the help, and making me take a second to look further at it!
> 
>   Bryan
> 
> 
> On Mon, 30 Sep 2002, Jason Young wrote:
> 
> |In my pages, I just format the date from the SQL query:
> |
> |"SELECT DATE_FORMAT(last_modified, '%m/%d/%Y %h:%i:%s %p') AS
> |last_modified (...)"
> |
> |Look up the DATE_FORMAT on mysql.com to get a list of the arguments.
> |
> |Hope this helps!
> |-Jason
> |
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: mysql timestamp and php date

2002-09-30 Thread Bryan Koschmann - GKT

Hi Jason,

I had come across this earlier, and while I can get it to return
perfectly, I was more looking for something that I could do without having
to pull 2 queries. Err, well wait, I wouldn't have to would I? I have 4
columns:

idnum, title, date, news

I was just doing a select * from newlist, but I suppose I can just address
each specifically:

select idnum, title, DATE_FORMAT(date, '%W, %M %D \@ %h:%i%p'), news from
newslist

right? Okay that works.

(don't mind me talking to myself)

Thanks for the help, and making me take a second to look further at it!

Bryan


On Mon, 30 Sep 2002, Jason Young wrote:

|In my pages, I just format the date from the SQL query:
|
|"SELECT DATE_FORMAT(last_modified, '%m/%d/%Y %h:%i:%s %p') AS
|last_modified (...)"
|
|Look up the DATE_FORMAT on mysql.com to get a list of the arguments.
|
|Hope this helps!
|-Jason
|


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php