fenderville Posted December 14, 2009 Share Posted December 14, 2009 Hello, I am trying to update multiple records at once but only one field per record. The first script is a drop down that menu where you select the associated records to be changed. The second script displays the records that are to be changed with a input field to enter the new information to update the field in the records. The final script does all the updating. But I cant get it to work.. It updates all the associated fields in the records like its supposed to but it updates the with "array" instead of what is in the input field. $con = mysql_connect("localhost","xxxx","xxxxxxxxxxxxx"); mysql_select_db("pass", $con); $room = $_GET['room']; $file_list = $_POST['doc_id']; foreach ($file_list as $key=>$value) { $id = $key; //GET INFO ABOUT THE FILE $query =mysql_query("SELECT * FROM documents WHERE DocID='$id'"); $data = mysql_fetch_assoc($query); //and updste file from database $query = "UPDATE documents SET fileOrder='$file_list' WHERE DocID= '$id'"; // $query = "Update SET documents WHERE DocID= '$id'"; $result = mysql_query($query); } Let me know if you need any more information.. and Thanks! Link to comment https://forums.phpfreaks.com/topic/185116-updating-multiple-records-at-once/ Share on other sites More sharing options...
MatthewJ Posted December 14, 2009 Share Posted December 14, 2009 With just a quick glance, it looks like $file_list in your query should be $value instead $query = "UPDATE documents SET fileOrder='$value' WHERE DocID= '$id'"; Link to comment https://forums.phpfreaks.com/topic/185116-updating-multiple-records-at-once/#findComment-977175 Share on other sites More sharing options...
fenderville Posted December 14, 2009 Author Share Posted December 14, 2009 BINGO... Wow.. Thank you very much.. it is amazing the little things that can a day. Thanks! Link to comment https://forums.phpfreaks.com/topic/185116-updating-multiple-records-at-once/#findComment-977185 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.