问题
I have a problem, I'm using pdo for make queries in my mysql database. When I want make an insert in my table of only one record, this insert TWO rows..
I dont know why insert two when this should insert only one. This is the php code:
<?php
$db = new PDO("mysql:host=localhost;dbname=mydatabase", "root", "");
$sql = "INSERT INTO test(lala)VALUES('xx1')";
$db->query($sql);
?>
回答1:
Check HTTP requests.
Most likely your code acts as a 404 handler and there is an extra request from browser.
来源:https://stackoverflow.com/questions/23890638/pdo-insert-two-rows-when-i-wanna-insert-only-one