Jump to content

abshaw

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

abshaw's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok tried the quotes as well still get this error You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('CONCAT(day,' ',month,' ',year)', '%e %M %Y') as modate FROM t
  2. thank you for the reply bqallover, and sir william, I have tried the given query and it doesnt work. On the next go around i broke the query down and it works in steps, here is what i got. STEP 1. $query1 = "SELECT CONCAT(day,' ',month,' ',year) as modate FROM torders ORDER BY modate"; works and here are the first 3 lines of result 1 April 2006 1 January 2007 1 October 2006 10 December 2006 STEP 2. $query1 = "SELECT STR_TO_DATE(CONCAT(day,' ',month,' ',year), '%e %M %Y') as modate FROM torders ORDER BY modate"; does not work and here is the error i get You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(CONCAT(day,' ',month,' ',year), '%e %M %Y') as modate FROM tor after getting this error i did a phpinfo() on the server and here is what i got MySQL-------------------------------- Support enabled Active Persistent Links-----------------  0  Active Links---------------------------  0  Client API version----------------------  4.0.16  MYSQL_MODULE_TYPE-----------------  external  MYSQL_SOCKET-----------------------  /tmp/mysql.sock  MYSQL_INCLUDE-----------------------  -I/usr/local/mysql/include/mysql  MYSQL_LIBS -------------------------- -L/usr/local/mysql/lib/mysql -lmysqlclient  and this is all on a FreeBSD ----4.11-STABLE FreeBSD 4.11-STABLE #0: Wed Apr i386 what am i doing wrong, please help
  3. I have php and mysql running, the database has a table named torders and there are 3 fields that store the date (not my fault, was handed to me like this-i know better than this) Field Name------------Sample data date--------------------7 month------------------November year--------------------2006 all i am trying to do is write an sql query to 1. join / contatinate all these fields to make a string date 2. convert the string date to a real date 3. format the date to display as Tuesday, November 7, 2006 4. Sort order by this date as well. here is what i have done so far and i am stratching my head up and down. $query1 = "Select str_to_date(day-month-year, '%d-%b-%Y') as modate from torders order by modate"; second try was $query1 = "Select str_to_date(CONCAT(day,'-', month,'-', year), '%d-%b-%Y') as modate from torders"; then i gave up and did not try the //DATE_FORMAT(, '%d/%M/%Y')"; at all. can any one of you great minds help
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.