此語句中的語法錯誤在哪裏?我沒有得到它,在這種情況下,我可以使用「?bind param方法」嗎?我使用的PDO語法錯誤mysql
$stmt = $dbh->prepare("INSERT INTO epinfo WHERE TVShowTitle=? (Season, Episode, SDLink, HDLink, DlSDLink, DlHDLink) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->bindParam(1, $_POST[tvshow]);
$stmt->bindParam(2, $_POST[season]);
$stmt->bindParam(3, $_POST[episode]);
$stmt->bindParam(4, $_POST[sdlink]);
$stmt->bindParam(5, $_POST[hdlink]);
$stmt->bindParam(6, $_POST[dlsdlink]);
$stmt->bindParam(7, $_POST[dlhdlink]);
$stmt->execute();
Error message:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE TVShowTitle='Breaking Bad' (Season, Episode, SDLink, HDLink, DlSDLink, DlH' at line 1
是否要更新現有記錄? –
你的where子句沒有意義。您可能希望更新而不是INSERT –
在末尾放置「where」子句。查看MySQL語法來完成此操作。 – Daniel