cdoggg94 Posted December 12, 2011 Share Posted December 12, 2011 Is there something seriously wrong with this code that im missing ? I have written it at least 10-12 different ways and it will NOT update my db.. <?php mysql_connect('localhost','root',''); mysql_select_db('myDB'); $dates = $_POST['date']; $store = $_POST['store']; // these actually display the correct information mysql_query = ("UPDATE Agency Stores - Table 1 SET date = '".$date."' WHERE F3 = '".$store."' "); ?> there are several other columns in the table. I have tried to put them in as the value they already have and it still didnt work... any ideas ? Link to comment https://forums.phpfreaks.com/topic/252999-mysql-update/ Share on other sites More sharing options...
Winstons Posted December 12, 2011 Share Posted December 12, 2011 "Agency Stores - Table 1" - is there name of your table ? Also not initialized variables $dates and $store will cause Notice with error_reporting(E_ALL) You must initialize their mysql_connect('localhost','root',''); mysql_select_db('myDB'); $dates = isset($_POST['date']) ? $_POST['date'] : NULL; $store = isset($_POST['store']) ? $_POST['sotore'] : NULL; // these actually display the correct information mysql_query("UPDATE `Agency Stores - Table 1` SET `date` = '".$date."' WHERE `F3` = '".$store."' ") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/252999-mysql-update/#findComment-1297108 Share on other sites More sharing options...
PFMaBiSmAd Posted December 12, 2011 Share Posted December 12, 2011 Your code isn't actually calling the mysql_query function. The light blue mysql_query is a link to the php.net manual page that shows several examples of how to form a query statement and call the mysql_query function. Link to comment https://forums.phpfreaks.com/topic/252999-mysql-update/#findComment-1297109 Share on other sites More sharing options...
cdoggg94 Posted December 12, 2011 Author Share Posted December 12, 2011 Yes that was the name of the table...it was pre-made from an excel sheet and i haven't changed it... Thanks Link to comment https://forums.phpfreaks.com/topic/252999-mysql-update/#findComment-1297112 Share on other sites More sharing options...
Winstons Posted December 12, 2011 Share Posted December 12, 2011 Sorry. I've corrected my code. Link to comment https://forums.phpfreaks.com/topic/252999-mysql-update/#findComment-1297113 Share on other sites More sharing options...
PFMaBiSmAd Posted December 12, 2011 Share Posted December 12, 2011 The original code contains that problem as well. Link to comment https://forums.phpfreaks.com/topic/252999-mysql-update/#findComment-1297114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.