Redlightpacket Posted October 15, 2009 Share Posted October 15, 2009 Here is my error message I get. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[1] = 'listen'' at line 1 Some how it won't write data in the first and next and next fields in my database table. //Trying to make this data go into the database table. //SET $column=array("listen","date","message"); $value=array("listen","date","message"); //WHERE $column2=array("video","listen","date"); $value2=array("video","listen","date"); $counts = 1; while($counts < 4) { $counts = 0 + $counts; $n = 1; $n2 = 1; $n = 0 + $n; $n2= 0 + $n2; $result = mysql_query("UPDATE _0_sermon_data_file SET $column[$n] = '$value[$n]' WHERE column2[$n2] = '$value2[$n2]'") or die(mysql_error()); } /////////////////////////////////////////////////////////////////////////////////////////////////////////// Link to comment https://forums.phpfreaks.com/topic/177737-need-help-with-trying-to-make-update-write-data-to-the-database/ Share on other sites More sharing options...
avvllvva Posted October 15, 2009 Share Posted October 15, 2009 try proper string quotes $result = mysql_query("UPDATE _0_sermon_data_file SET ".$column[$n]." = '".$value[$n]."' WHERE ".column2[$n2]." = '".$value2[$n2]."'") Link to comment https://forums.phpfreaks.com/topic/177737-need-help-with-trying-to-make-update-write-data-to-the-database/#findComment-937212 Share on other sites More sharing options...
cags Posted October 15, 2009 Share Posted October 15, 2009 Since column2 is an array in your script, not a table in your database you require a dollar sign to signify it as a variable. WHERE column2[$n2] Link to comment https://forums.phpfreaks.com/topic/177737-need-help-with-trying-to-make-update-write-data-to-the-database/#findComment-937267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.