jaxdevil Posted May 19, 2008 Share Posted May 19, 2008 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 />"; ?> Link to comment https://forums.phpfreaks.com/topic/106253-solved-php-sql-update-putting-data-into-wrong-columns/ Share on other sites More sharing options...
pocobueno1388 Posted May 19, 2008 Share Posted May 19, 2008 echo the query out to see if it's coming out how it's expected to. Link to comment https://forums.phpfreaks.com/topic/106253-solved-php-sql-update-putting-data-into-wrong-columns/#findComment-544593 Share on other sites More sharing options...
jaxdevil Posted May 19, 2008 Author Share Posted May 19, 2008 Never mind, solved it. It was a problem with the variable being sent to the script, not the script itself. Thanks anyways! SK Link to comment https://forums.phpfreaks.com/topic/106253-solved-php-sql-update-putting-data-into-wrong-columns/#findComment-544594 Share on other sites More sharing options...
jaxdevil Posted May 19, 2008 Author Share Posted May 19, 2008 echo the query out to see if it's coming out how it's expected to. Thats exactly what I did, that solved it. Thanks! Link to comment https://forums.phpfreaks.com/topic/106253-solved-php-sql-update-putting-data-into-wrong-columns/#findComment-544595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.