Jump to content

Updating multiple records at once?


fenderville

Recommended Posts

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

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.