Page 3 of 3

Posted: Tue Jan 18, 2005 9:53 am
by mohson

Did you put quotes around your query

$query = "SELECT .... ";


oops yeh that was it - atleast my data is being displayed again but now I have another problem the date fields appear blank so data isnt being displayed in those fields

the code

$query = "SELECT *, DATE_FORMAT('%d/%m/%y', `dateoflastcontact`)
AS `dateoflastcontact`, DATE_FORMAT('%d/%m/%y', `datecontactagain`)
AS `datecontactagain` FROM `people` ORDER BY `firstname`";


any help

Posted: Tue Jan 18, 2005 9:57 am
by feyd
:oops: I'm so sorry.. need to switch the order of arguments sent to DATE_FORMAT:

Code: Select all

$query = "SELECT * DATE_FORMAT(`dateoflastcontact`, '%d/%m/%y')
AS `dateoflastcontact`, DATE_FORMAT(`datecontactagain`, '%d/%m/%y')
AS `datecontactagain` FROM `people` ORDER BY `firstname`";

Posted: Tue Jan 18, 2005 9:57 am
by ckuipers
How are you calling the datefields?

dateoflastcontact & datecontactagain?

Posted: Tue Jan 18, 2005 10:03 am
by mohson
feyd

that doesnt work at all

Code: Select all

$query = "SELECT * DATE_FORMAT(`dateoflastcontact`, '%d/%m/%y') 
AS `dateoflastcontact`, DATE_FORMAT(`datecontactagain`, '%d/%m/%y') 
AS `datecontactagain` FROM `people` ORDER BY `firstname`";

This works but it doesnt display the date for some reason it isnt displaying the dates

Code: Select all

$query = "SELECT *, DATE_FORMAT('%d/%m/%y', `dateoflastcontact`) 
   AS `dateoflastcontact`, DATE_FORMAT('%d/%m/%y', `datecontactagain`) 
   AS `datecontactagain` FROM `people` ORDER BY `firstname`";

Posted: Tue Jan 18, 2005 10:05 am
by feyd
sorry.. forgot to add the comma into the code I copied :oops:

Code: Select all

$query = "SELECT *, DATE_FORMAT(`dateoflastcontact`, '%d/%m/%y')
AS `dateoflastcontact`, DATE_FORMAT(`datecontactagain`, '%d/%m/%y')
AS `datecontactagain` FROM `people` ORDER BY `firstname`";
my brain is off today, I guess :roll:

Posted: Tue Jan 18, 2005 10:54 am
by mohson
THANK YOU SO MUCH FEYD - problem sorted!! :lol: