php - How do I update mysql table using pdo and multiple arrays? -


i've got list of form fields in html table. page designed allow modify multiple records @ once...using update query. because have multiple customer records present, need update based on record id. thought supposed create composite array update database pointing various key, value pairs, nothing seems work...all appreciated..hoping small typo i'm not catching:

....sql pull data (works)...  echo "<form action='#' method='post' >"; echo "<center><table>"; echo "<tr><th> email address </th> <th>created on</th><th> ip address</th><th> front of card</th><th> of card</th><th> last 4 of card</th><th> decision</th><th> notes (for reject)</th>"; foreach ($customer $row){       echo '<tr><input type="hidden" name="record[]" value='.$row[' id '].'/>     <td>'.$row["email"].' </td>     <td>'.$row["created_on"].'</td>     <td>'.$row["ip_address"].'</td>     <td>         <a href="imgreader.php?img='.$row["card_front"].'"><img class="fixed" src="imgreader.php?img='.$row[" card_front "].'"/></a>     </td>     <td>         <a href="imgreader.php?img='.$row["card_back"].'"><img class="fixed" src="imgreader.php?img='.$row[" card_back "].'"/></a>     </td>     <td><input type="number" name="last4[]" value="" /></td>     <td><select name="decision[]">       <option value="pending">pending</option>       <option value="approved">approved</option>       <option value="denied">denied</option>       <option value="duplicate">duplicate</option></select></td>     <td><input type="textarea" rows="5" name="notes[]" value="" /></td> </tr>'; if ($_post){  $last4 = $_post["last4"]; $status = $_post["decision"]; $notes = $_post["notes"]; $ids = $_post["record"];   $tableset = array('last4' => $last4,       'decision' => $status,       'notes' => $notes,       'ids' => str_replace('/','', $ids)       ); var_dump($tableset);  foreach( $tableset $i) {               $updateuserdata = $db->prepare("update cards set `last_4_cc` = :l4cc, `status` = :status, `notes` = :notes `id` = :record");              $updateuserdata->execute([                 ':l4cc' =>  $i[$tableset["last4"]],                 ':status' => $i[$tableset["decision"]],                 ':notes' => $i[$tableset["notes"]],                 ':record' => $i[$tableset["ids"]]                 ]);     }  }  ?> 


Comments