I am trying to update multiple records in a database and nothing happen with the existing code. It should update all entries’ supplemental_info value when the $_GET[“dataID”] variable equals the originating_dataID value in the new_file2 query. Thank you in advance with your help
Here is my code:
if ($originator == 'Y') {
$new_file2 = new WA_MySQLi_RS("new_file2",$sdpc_i,1);
$new_file2->setQuery("SELECT supplemental_info FROM data WHERE dataID = ?");
$new_file2->bindParam("i", "".$_GET['dataID'] ."", "-1"); //colname
$new_file2->execute();
$supplemental_info_file_name = $new_file2->getColumnVal("supplemental_info");
$new_file = new WA_MySQLi_RS("new_file",$sdpc_i,0);
$new_file->setQuery("SELECT dataID FROM data WHERE originating_dataID = ?");
$new_file->bindParam("i", "".$_GET['dataID'] ."", "-1"); //colname
$new_file->execute();
while($row = mysqli_fetch_array($new_file)) {
$multiple_dataID[] = $row['dataID'];
}
foreach ($multiple_dataID as $thedataID) {
$UpdateQuery = new WA_MySQLi_Query($sdpc_i);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`data`";
$UpdateQuery->bindColumn("supplemental_info", "s", "".((isset($supplemental_info_file_name))?$supplemental_info_file_name:"") ."", "WA_NULL");
$UpdateQuery->addFilter("dataID", "=", "i", "".($thedataID) ."");
$UpdateQuery->execute();
}
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}