List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 24 2001 4:13am
Subject:Re: sql error
View as plain text  
At 4:20 PM -0700 7/23/01, Dan Huston wrote:
>Hello All,
>
>I am getting this error:
>
>DBD::mysql::st execute failed: You have an error in your SQL syntax 
>near ''user_id', 'sem1_acad_id', 'sem1_course_id', 'sem1_ver', 
>'Sem_1_Final') VALUES (' at line 1 at flatten_er5.pl line 132, 
><DATA> line 136342.
>
>
>in the trace log I see this:
>
>Setting mysql_use_result to 0
>     <- prepare= DBI::st=HASH(0x1b7812c) at flatten_er5.pl line 130.
>     -> execute for DBD::mysql::st (DBI::st=HASH(0x1b7812c)~0x31ac984 
>'user_id' 'sem1_acad_id' 'sem1_course_id' 'sem1_ver' 'Sem_1_Final' 
>'230839' '8243' '1' '1.1' '94')
>     -> dbd_st_execute for 031ac978
>       Binding parameters: insert into kevin ('user_id', 
>'sem1_acad_id', 'sem1_course_id', 'sem1_ver', 'Sem_1_Final') VALUES 
>( '230839', '8243', '1', '1.1', '94')
>     ERROR EVENT 1064 'You have an error in your SQL syntax near 
>''user_id', 'sem1_acad_id', 'sem1_course_id', 'sem1_ver', 
>'Sem_1_Final') VALUES (' at line 1' on DBI::st=HASH(0x31ac984)
>You have an error in your SQL syntax near ''user_id', 
>'sem1_acad_id', 'sem1_course_id', 'sem1_ver', 'Sem_1_Final') VALUES 
>(' at line 1 error 1064 recorded: You have an error in your SQL 
>syntax near ''user_id', 'sem1_acad_id', 'sem1_course_id', 
>'sem1_ver', 'Sem_1_Final') VALUES (' at line 1
>     <- dbd_st_execute -2 rows
>     !! ERROR: 1064 'You have an error in your SQL syntax near 
>''user_id', 'sem1_acad_id', 'sem1_course_id', 'sem1_ver', 
>'Sem_1_Final') VALUES (' at line 1'
>     <- execute= undef at flatten_er5.pl line 132.
>     -> prepare for DBD::mysql::db (DBI::db=HASH(0x1b7803c)~0x1b7806c 
>'insert into kevin (?, ?, ?, ?, ?) VALUES ( ?, ?, ?, ?, ?)')
>     New DBI::st (for DBD::mysql::st, parent=DBI::db=HASH(0x1b7806c), id=)
> 
>dbih_setup_handle(DBI::st=HASH(0x31ac9cc)=>DBI::st=HASH(0x1bd9964), 
>DBD::mysql::st, 31ac9d8, Null!)
>     dbih_make_com(DBI::db=HASH(0x1b7806c), DBD::mysql::st, 204)
>
>So I am confused because it looks like my values are being plugged 
>in at the execute statement, but it always errors out.  Here is the 
>code:
>
>	$sql_01 = $dbh->prepare("insert into kevin (?, ?, ?, ?, ?) 
>VALUES ( ?, ?, ?, ?, ?)");
>
>	$sql_01->execute($user_id, $field_sem_acad, $field_sem_crse, 
>$field_sem_ver, $new, $u_id, $a_id, $lvc, $ver, $sc);
>
>Am i missing something really obvious?

Placeholders are for data values, not column names.

-- 
Paul DuBois, paul@stripped
Thread
sql errorDan Huston24 Jul
  • Re: sql errorPaul DuBois24 Jul