Jump to content

[SOLVED] PHP Sql UPDATE putting data into wrong columns


jaxdevil

Recommended Posts

Oh great, something else now. Well the function is processing, it has no more sql errors, but the data is posting incorrectly. You see the 11 fields, right? Well it is posting the $price variable into the `man` column, and posting the $list variable into the `price` column, and is posting nothing into the `list` column, or rather it is erasing the data that was in the `list` column since it is leaving nothing in that field after the updating has processed.

 

Please look at the revised code and see if you see anything. I put quotes on everything now, just to be safe, but that didn't do it.

 

<?php
$query = "UPDATE products SET `supplier`='$supplier',`cat`='$cat',`subcat`='$subcat',`man`='$man',`mod`='$mod',`name`='$name',`list`='$list',`price`='$price',`specs`='$specs',`pdf`='$pdf',`active`='$active' WHERE `mod`='$oldmod'";
mysql_query($query) or die( "An error has ocured: " .mysql_error (). ":" .mysql_errno ());
print "<h1>Inventory Update Successful</h1><br>data<br /><br /><em>Updated!</em><br /><br />";
?>

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.