Mysql query fails

inter

Active member
Joined
Jul 22, 2005
Messages
36
Hello,

I have an insert query that works on mysql and another delete statement that doesnt seem to work when executing on mysql.....

the problem is with the datetime I think.....

this works:
Code:
     sql = "insert into tblchat (tijd, tekst, naam) values (str_to_date(" & now & ",%d/%m/%Y %H:%i:%s)," & gesplitst(0) & "," & gesplitst(1) & ")"
this doesnt work:
Code:
     sql = "delete * from tblchat where tijd < STR_TO_DATE(" & dateadd("s",-5,now) & ",%d/%m/%Y %H:%i:%s) "
I dont understand why...Is the delete statement wrong syntax????

greets,

Inter

EDIT: this code did work on an access database but instead of STR_TO_DATE I used cdate.
 
Hi,
when my SQL dont work as I was hoping for when building the string I always prints the resulting string (ie sql), copies it to an open GUI of the database where I run the query.
It has two advantages,
1. when the sql is printed you can clearly see whats supposed to happen and solve many problems there
2. The database GUI gives you additional information about the query (I know you can print mysql_error in your app, but somehow its more obvious in the GUI)

HTH
/Kejpa
 
already solved it...

thx. that is the way I did it too ;-)

no * in the delete statement ;-)
 
inter said:
what is the best free GUI for mysql anyway ?
Best Im not sure of but I like SQLYog alot. Check out Webyog home page
mySQL Ab is providing a free tool MySQLCC (MySQL Control Center) which I have installed but not used very much.

/Kejpa
 
Back
Top