Hi,
I have a table where multiple checkboxes are ticked and values put into an array. These values echo ok but when i use the foreach part of the script, it doesnt get processed. Could someone please have a look at the script and see what mistake i am making ? Thanks ! Swati
$customer = $_POST["customer"];
$array = implode(",", $customer);
print_r(($array)); // prints out selected values 15,25,106, 3457 etc
foreach ($array as $value)
{
$sql = "UPDATE `Customers` SET `CGID` = $group WHERE `CID` = $array";
(also tried $sql = "UPDATE `Customers` SET `CGID` = $group WHERE `CID` = $value";)
echo $sql ; // This should yield the foll :
//UPDATE `Customers` SET `CGID` = 2 WHERE `CID` = 15";
//UPDATE `Customers` SET `CGID` = 2 WHERE `CID` = 25";
//UPDATE `Customers` SET `CGID` = 2 WHERE `CID` = 106";
//UPDATE `Customers` SET `CGID` = 2 WHERE `CID` = 3457";
$customer can yield only 1 record or 20 records and hence i need to have the update work for every record it throws up/
$result = mysql_query($sql);
echo "Information Updated" ;
}