我的查询在phpmyadmin中插入数据,但不从我在PHP中的应用程序插入

时间:2017-03-10 12:18:39

标签: php mysql

我写了3个查询,必须一次在3个表中插入数据... 它适用于mysql(phpmyadmin)....正确和插入数据。 但是当我在php中编写这个程序时它不起作用...... 它让我发疯请帮我 ... 我的查询

INSERT INTO `deliverydatetimetable`(`DeliveryId`,`Year`, `Month`, `Day`, `Hour`, `Minutes`, `Second`) VALUES ('$DeliveryId','','','','','','');
                                  INSERT INTO `deliverylocationtable`(`DeliveryId`,`DeliveryLatitude`, `DeliveryLongitude`, `RequestId`, `Accepted`, `DeliveryAddress`) VALUES ('$DeliveryId','','','','','');
                                  INSERT INTO `deliveryworkstatetable`(`DeliveryId`,`IsBusy`) VALUES ('$DeliveryId','');

php code

function activateRelatedTables(){
$connection=createConnection();
$json = file_get_contents('php://input');
$obj = json_decode($json);
$DeliveryId=$obj->DeliveryId;
$result=mysqli_query($connection,"INSERT INTO `deliverydatetimetable`(`DeliveryId`,`Year`, `Month`, `Day`, `Hour`, `Minutes`, `Second`) VALUES ('$DeliveryId','','','','','','');
                                  INSERT INTO `deliverylocationtable`(`DeliveryId`,`DeliveryLatitude`, `DeliveryLongitude`, `RequestId`, `Accepted`, `DeliveryAddress`) VALUES ('$DeliveryId','','','','','');
                                  INSERT INTO `deliveryworkstatetable`(`DeliveryId`,`IsBusy`) VALUES ('$DeliveryId','');");
echo json_encode(array('Result'=>$result));
mysqli_close($connection);
}

0 个答案:

没有答案