pdo insert two rows when I wanna insert only one

坚强是说给别人听的谎言 提交于 2019-12-25 02:47:21

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!