quasiman Posted April 23, 2007 Share Posted April 23, 2007 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 More sharing options...
LazyJones Posted April 23, 2007 Share Posted April 23, 2007 1. That code doesn't (even try to) print anything. 2. There's one mysql_query() before the actual sql expression is created. (might lead to unexpected errors) Link to comment https://forums.phpfreaks.com/topic/48255-php-mysql-update-echo-not-updated-list/#findComment-235883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.