简体   繁体   English

PHP Mysqli不更新数据库中的数据

[英]Php Mysqli not updating data in database

Here is my code, it works and no errors pop up and the correct data for the variables are there. 这是我的代码,可以正常工作,不会弹出错误,并且那里有变量的正确数据。

When it's all done it shows Done for the last echo. 完成所有操作后,将显示“ Done for the last echo”。

However, when I go into heidisql to view the database table, nothing has changed, even when I run the query in heidisql , still same results. 但是,当我进入heidisql查看数据库表时,即使我在heidisql运行查询,结果也没有改变。

// Make connection to database
$connection = mysqli_connect($host,$user,$pass,$dbnm);
// Make query
$myQuery = "
    UPDATE Ekhaya_Inventory SET 
        ekhaya_inventory_stock_item = '" . $stockItemPost . "',
        ekhaya_inventory_stock_left = '" . $stockLeftPost . "',
        ekhaya_inventory_stock_out = '" . $stockOutPost . "',
        ekhaya_inventory_stock_minimum = '" . $stockMinimumPost . "',
        ekhaya_inventory_stock_price_per_item = '" . $stockPricePIPost . "',
        ekhaya_inventory_value_of_stock_left = '" . $stockValueOfStockLeftPost . "' 

        WHERE
            ekhaya_inventory_stock_code = '" . $stockCodePost . "' 
        AND
            ekhaya_inventory_stock_code = '" . $stockLocationPost . "'
";

mysqli_query($connection,$myQuery)or die("Error: ".mysqli_error($connection));
mysqli_close($connection)or die("Error: ".mysqli_error($connection));
echo "<br>Done";
WHERE
            ekhaya_inventory_stock_code = '" . $stockCodePost . "' 
        AND
            ekhaya_inventory_stock_code = '" . $stockLocationPost . "'

it is wrong because one field can`t contain two different values in the same time 这是错误的,因为一个字段不能同时包含两个不同的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM