I have a mysql table with a field named ‘status’-tinyint(1).
I have a form that show all of the images from that table with 2 checkboxes for each image. One for ‘hide’ and one for ‘show’. This is just a form for me to be able to hide pictures in the gallery of a website.
When ‘status’ is set to 0 the image is hidden from the gallery, when status is set to 1 it is shown in the gallery. I have written code for this but there is a problem somewhere as it never changes the value in ‘status’
[php]<?php
include ‘connect.php’;
if(isset($_POST[‘zero’])){
$chk = (array) $_POST['zero'];
$p = implode(',',array_keys($chk));
if ($sql = mysql_query("UPDATE reptile_thumbs SET status = 0 WHERE `id` = $p")){
echo 'Image hidden from gallery.';
echo $p;
}
else{
echo 'There has been a problem. Go back and try again.';
}
}
else if(isset($_POST['one'])){
$chk = (array) $_POST['one'];
$p = implode(',',array_keys($chk));
if ($sql = mysql_query("UPDATE reptile_thumbs SET status = 1 WHERE `id` = $p")){
echo 'Image visible in gallery.';
}
else{
echo ‘There has been a problem. Go back and try again.’;
}
}
?>[/php]
Can anyone see what is going wrong?
Thanks for looking…