简体   繁体   中英

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.

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.

// 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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