0
我从我的android应用程序发送的数据添加到在线数据库中。但是数据不会存储在表格的末尾。它被存储在表中的随机位置。我如何避免这种情况?这里是我的PHP代码。在SQL表末尾没有插入项目android
<?php
error_reporting(E_ALL^E_DEPRECATED);
$response = array();
$title = $_POST['Title'];
$time = $_POST['Time'];
$posted= $_POST['posted'];
require_once __DIR__ . '/db_connect.php';
$db = new DB_CONNECT();
$result = mysql_query("INSERT INTO mukul(Title, Time, posted) VALUES('$title', '$time', '$posted')");
if ($result) {
$response["success"] = 1;
$response["message"] = "Product successfully created.";
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
echo json_encode($response);
}
?>
它不是sqlite数据库,它是php和mysql,所以我建议你编辑你的文章,让有经验的人可以回答你 – SaNtoRiaN
这不会解决你的问题,但无论如何非常重要。不要使用'mysql_'函数。它们已被弃用,并且您使用它们的方式会使您容易受到[SQL注入攻击](http://bobby-tables.com/php.html)的影响。相反,使用MySQLi或PDO。 – Anders