in reply to Re: Re: DBI::mysql
in thread DBI:mysql

Thanks.

Looking at the first attempt, the error is clear: you're passing one bind value (a string containing comma-separated values), and it's expecting 4 bind values (a list of the 4 values, instead of the string).

In the second attempt, sending @values to execute(), the first problem does not occur- you successfully execute with the list of 4 @values that crashed the first example. Instead, you have another problem further along:

-> execute for DBD::mysql::st (DBI::st=HASH(0x81f9c2c)~0x81f9bf0 '160' + '1168280448' '10081' '15' '0' '2002-03-31 23:08:31-05' '0' '' '1' '0 +' 'undef') -> dbd_st_execute for 081f9bfc Binding parameters: INSERT INTO basket VALUES ('160',1168280448,10 +081,'15',0,2002-03-31 23:08:31-05,0,,1,0,undef) You have an error in your SQL syntax near '23:08:31-05,0,,1,0,undef)' +at line 1 error 1064 recorded: You have an error in your SQL syntax n +ear '23:08:31-05,0,,1,0,undef)' at line 1
This is a little bit weird- it looks like the execute() statement isn't correctly quoting your date. The insert statement doesn't have quotes around the date. Most likely SQL is interpreting 2002-03-31 as a subtraction of 3 integers, and then getting confused when it gets to the 23:08:31-05.

I'd try manually quoting the date "2002-03-31 23:08:31-05" before sending it in as an execute() value. Unfortunately, it's not obvious where this can be done in your code.

Alan

Replies are listed 'Best First'.
Re: Re: Re: Re: DBI::mysql
by Dalin (Sexton) on Apr 15, 2002 at 15:41 UTC
    I can see my error now with the string, thanks. I think the best thing to do will be to check for the timestamp and do a bind_param. How would you build a regex to check for the timestamp?
    /\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d\-\d\d/
    Possibly??
    Thank you for all of you help today. Bradley