I have a form and I have many values. When I am trying the save these values to the MySQL, it doesn’t save the zero values which are coming from form.
Here is my codes.
for($i=0;$i<count($cevap_deger);$i++){
$cevapkontrol = trim($cevap_deger[$i]);
if(!empty($cevapkontrol)){
$sorgu = mysql_query("insert into CRM9001(CRM9107,CRM9102,CRM9103,CRM9105,CRM9109,CRM9108) values ('".$cevap_deger[$i]."','".$sinav_id[$i]."','".$bolum_id[$i]."','".$soru_id[$i]."','".$birey_id[$i]."','".$kullanici_id[$i]."') ");
header("Refresh: 0; url=dashboard.php");
}
}
It saves other values but only 0 it doesn’t save. I tried this also;
for($i=0;$i<=count($cevap_deger);$i++){
If you help me I will be very glad.
php.net says:
The following things are considered to be empty:
note that you insert data into the database only if
$cevapkontrolis notemptyas inif(!empty($cevapkontrol)){}and 0 considered to be empty as mentioned