Hi,
I’m struggling with this piece of code although I know there is a simple solution, the loop only executes the code once where it should multiple times.
[code=php] $query = “SELECT * FROM practitioners WHERE approved = 1”;
$result = pg_query($query);
if (!$result) {
echo “Problem with query ” . $query . “<br/>”;
echo pg_last_error();
}
while($myrow = pg_fetch_assoc($result)) {
$idx = $myrow[‘practitioner_id’];
$form_results = $_POST[“$idx”];
if($form_results=’yes’)
{
$query = “UPDATE practitioners SET approved=’0′ where practitioner_id=’$idx'”;
$result = pg_exec($db, $query);
if (!$result) {
printf (“ERROR”);
$errormessage = pg_last_error();
echo $errormessage;
exit;
}
}
}
$idx are the values sent through the form