Jump to content

php mysql update - echo not updated list


quasiman

Recommended Posts

I have 2 tables, "Inventory" contains a few details about the shop items, "Shop" contains all the information.  I'm doing it this way because the information is coming from a csv on another server.

So I'm looking for a way to update item quantities between the tables, then echo/print any records that don't exist yet to be updated.

 

Then I can manually add any new records to my shop database and it will update as usual next time.

 

Anyway, here's what I have so far, but it doesn't display my extra records.

 

  mysql_connect("localhost", "login", "password");
mysql_select_db("database");


$search = mysql_query("SELECT * FROM Inventory");

while($row = mysql_fetch_array( $search )) {
$Count = $row['Available'];
$Item = $row['SKU'];

$result = mysql_query($sql);
$sql = "UPDATE Shop SET ItemQuantity = '$Count' WHERE ItemSKU = '$Item'";
$result = mysql_query($sql) or die;
}

Link to comment
https://forums.phpfreaks.com/topic/48255-php-mysql-update-echo-not-updated-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.