简体   繁体   中英

odbc sql statement

could anybody tell me whats wrong about this statement?

$sql = "INSERT INTO FK_Kunde(Anschrift_Vorname) VALUES('".$_POST['vorname']."') WHERE Anschrift_Vorname = 'Petra'";

errmsg:

Warning: odbc_exec(): SQL error: [SAP][ODBC Driver][SQL Anywhere]Syntaxfehler bei 'WHERE' in Zeile 1, SQL state 37000 in SQLExecDirect in C:\xampp\htdocs\php2lex\write2Odbc.php on line 16
shit happens [SAP][ODBC Driver][SQL Anywhere]Syntaxfehler bei 'WHERE' in Zeile 1

There is no Syntax like insert into ... values ... where - Think you need an update statement.

$sql = "Update FK_Kunde set Anschrift_Vorname = '".$_POST['vorname']."' WHERE Anschrift_Vorname = 'Petra'";

Also you should lears about prepared statements to protact against SQL injection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM