<?php function updater_serv($connection,$email,$servicedta)//edit υπηρεσιών { $allowed = array_flip(['servicename','price','price_show','id']); // foreach ($servicedta as $update) { $update = array_intersect_key($update, $allowed); $id = array_pop($update); $values = array_values($update); $values[] = $id; $set = []; foreach ($update as $field => $value) { $set[] = "`{$field}`=:{$value}"; } $sql = 'UPDATE services_list SET ' . implode(', ', $set). ' WHERE serviceID='.$id; if($stmt=$connection->prepare($sql)) { $stmt->bind_param(str_repeat("s", count($set)+1), ...$values); $stmt->execute(); } } return 'update'; }
You have javascript disabled. You will not be able to edit any code.