Php MySQL UPDATE语句不更新数据库中的条目
无论如何,mysql代码并没有抛出错误。我试着在工作台中测试mysql语句,它工作了,它更新了条目。 下面是我的php代码,它将条目添加到数据库中。第二个查询工作,而第一个查询没有输入数据库Php MySQL UPDATE语句不更新数据库中的条目,php,mysql,Php,Mysql,无论如何,mysql代码并没有抛出错误。我试着在工作台中测试mysql语句,它工作了,它更新了条目。 下面是我的php代码,它将条目添加到数据库中。第二个查询工作,而第一个查询没有输入数据库 //Editing the Item $updateEntry1 ="UPDATE item SET price=120 WHERE itemName ='Cebu - Manila Airplane Ticket';"; retri
//Editing the Item
$updateEntry1 ="UPDATE item
SET price=120
WHERE itemName ='Cebu - Manila Airplane Ticket';";
retrieveTable($updateEntry1);
//Retrieve item id through searching the item name in the 'item' table
$selectId = "SELECT id
FROM item
WHERE itemName = '".$_POST['itemTravel']."';";
$retrieveId = retrieveTable($selectId);
$row = mysqli_fetch_array($retrieveId);
下面是retrieve table函数,该函数将信息存储在数据库中
function retrieveTable($query){
$config = parse_ini_file('/config.ini');
$connect = mysqli_connect($config['servername'], $config['username'], $config['password'], $config['database']);
$filter_Result = mysqli_query($connect, $query)or die (mysqli_error($connect));
return $filter_Result;}
在查询文本中有两条SQL语句。为每个语句分别运行
mysqli\u query()
您可能只是以现在的代码方式运行了第一条语句。您是否检查了配置文件是否正在加载是的,它实际上正在工作,因为我在代码的其他部分使用了该函数,并且它工作正常