[PHP] DATE_FORMAT (MySQL function)

2002-10-03 Thread Mark Colvin

I'm not sure if this is a php or mysql issue but I run the following query
from a php script -

$query = select d1.code, d1.type, d1.descr, d1.grouptype, d1.cusref,
d1.stock, d1.minstock, d1.appmeth, d1.supplier, d1.suppref, d1.leadtime,
d1.price, d1.reorder, d1.code1, d1.code2, d1.notes, d1.usr, d1.usr,
d1.cusname, d1.colours, d1.stitchcount, d1.height, d1.width,
DATE_FORMAT(d1.created, '%d-%m-%Y'), DATE_FORMAT(d1.amended, '%d-%m-%Y'),
d2.extdescr from decheader as d1, decextdescr as d2 where d1.code = d2.code
and d1.code = '00042' ;

The problem I am having is with the DATE_FORMAT. Running the above query
returns the following for the ‘width’ column.

94.40 DATE_FORMAT(d1.created, '%d-%m-%Y'): NULL DATE_FORMAT(d1.amended,
'%d-%m-%Y'): 03-10-2002

The ‘width’ column should only return 94.40. Why does this query put 3
columns into one?



This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


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




Re: [PHP] DATE_FORMAT (MySQL function)

2002-10-03 Thread Maurits Lawende

Hi,

You could try this query...

$query = SELECT `d1.code`, `d1.type`, `d1.descr`, `d1.grouptype`, `d1.cusref`,
`d1.stock`, `d1.minstock`, `d1.appmeth` , `d1.supplier`, `d1.suppref`, `d1.leadtime`,
`d1.price`, `d1.reorder`, `d1.code1`, `d1.code2`, `d1.notes`, `d1.usr`, `d1.usr`,
`d1.cusname`, `d1.colours`, `d1.stitchcount`, `d1.height`, `d1.width`,
DATE_FORMAT(`d1.created`, '%d-%m-%Y'), DATE_FORMAT(`d1.amended`, '%d-%m-%Y'),
`d2.extdescr` FROM `decheader` AS `d1`, `decextdescr` AS `d2` WHERE (`d1.code` = 
`d2.code`)
AND (`d1.code` = '00042');

If the code above doesn't work, try it in phpmyadmin and read the error 
if you get one.

hope it helps,
Maurits Lawende


Mark Colvin wrote:

I'm not sure if this is a php or mysql issue but I run the following query
from a php script -

$query = select d1.code, d1.type, d1.descr, d1.grouptype, d1.cusref,
d1.stock, d1.minstock, d1.appmeth, d1.supplier, d1.suppref, d1.leadtime,
d1.price, d1.reorder, d1.code1, d1.code2, d1.notes, d1.usr, d1.usr,
d1.cusname, d1.colours, d1.stitchcount, d1.height, d1.width,
DATE_FORMAT(d1.created, '%d-%m-%Y'), DATE_FORMAT(d1.amended, '%d-%m-%Y'),
d2.extdescr from decheader as d1, decextdescr as d2 where d1.code = d2.code
and d1.code = '00042' ;

The problem I am having is with the DATE_FORMAT. Running the above query
returns the following for the 'width' column.

94.40 DATE_FORMAT(d1.created, '%d-%m-%Y'): NULL DATE_FORMAT(d1.amended,
'%d-%m-%Y'): 03-10-2002

The 'width' column should only return 94.40. Why does this query put 3
columns into one?



This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


  





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