tags:

views:

18

answers:

1

Hello All

im upgrading mysql 4.x -> 5.x.

and in my php source there is mysql synxtax following.

$pt_sql = "select * from orderlist 
           where condition!='delete' 
            and left(date,10)='$nday' 
           group by id ";

how can i change above mysql syntax to mysql 5.x syntax?

if anyone help me much apprecate!

thanks in advance

+2  A: 

CONDITION is a reserved word in MySQL 5.0 (it was not in 4.1) so it must be in backticks in your queries:

select * from orderlist 
where `condition` != 'delete' 
and left(date,10)='$nday' 
group by id

You may also want to consider storing the column date as a date or storing it as datetime type and using the DATE function.

Mark Byers