I can't update my database by using select .. i've tried searching for different solutions but those didn't helped me ..
any ideas why this doesn't update my DB??
i need to update the row with such conditions:
the query/queries i used
$records = mysql_query("SELECT * FROM cot_cargovolume WHERE VoyageNo = '$_POST[txtVoyageNo]'");
$cvCOC = array($records);
$i = 0;
while($con = mysql_fetch_array($records)){
$cvCOC[$i] = $con['COC'];
$i++;
}
$CV_contents = array("$_POST[cargoVol1]","$_POST[cargoVol2]");
for($j=0;$j<$i;$j++){
$sql = "UPDATE cot_cargovolume SET CIC='CV_contents[$j]' WHERE VoyageNo='$_POST[txtVoyageNo]' AND COC = '$cvCOC[$j]'";
/*ERROR Report*/
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
echo "Updated - Details</br>";
}
the first query is that i want to retrieve the data from the column coc and use it for the condition as to where i want the update to happen. the VoyageNo works properly but i need the COC condition too..
i don't get any error using this code and it says "Updated details" but it doesn't really ..
thanks for any help, greatly appreciate it ..