UPDATE SET doesn't work
Posted: 24. June 2014 23:18
I need to update a database (scw_db) with a table (tblsplintersbowlinventory) from a list that contains id's, when I read an ID I want to set the txtVenue field of the matching record to "Shoreline 2014".
The code:
This runs through the list, prints that it updated the record - but when I check the record in myPHPadmin it has not changed.
And I really need to get this working by tomorrow - Wed, 6/25 - so a simple and complete answer that just works would really be appreciated.
The code:
- Code: Select all
<?php
$con = mysql_connect("localhost","xxxxx","xxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("scw-db", $con);
$filename = "InventoryList.txt";
$arr = file($filename);
foreach($arr as $r_bowlcode){
print $r_bowlcode . "<br />";
$query="UPDATE tblsplintersbowlinventory SET txtVenue='Shoreline 2014' WHERE txtProductBowlCode='$r_bowlcode'";
mysql_query($query);
echo "Record Updated";
}
mysql_close();
?>
This runs through the list, prints that it updated the record - but when I check the record in myPHPadmin it has not changed.
And I really need to get this working by tomorrow - Wed, 6/25 - so a simple and complete answer that just works would really be appreciated.