pdo insert two rows when I wanna insert only one

2019-09-01 05:51发布

问题:

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.



标签: pdo insert