Jump to content

Help with NULL


june_c21

Recommended Posts

Hi ,

 

I got a question . How to stop enter the data into database when the $causes == NULL ? 

 

Here is my code

<?php
include './includes/header.php';

for ($i=1;$i<11;$i++)
{
$id = $_GET ['id'];
$causes = $_POST ['causes'][$i];
  $corrective_action = $_POST ['corrective_action'][$i];
  $name = $_POST ['name'][$i];
  $date = $_POST ['date'][$i];
  $completedate = $_POST ['completedate'][$i];
  $remarks = $_POST ['remarks'][$i];
   $status = $_POST ['status'];

$query= "INSERT INTO corrective_action( id, causes, corrective_action, name, date, completedate, remarks ) VALUES ('$id','$causes','$corrective_action','$name','$date','$completedate','$remarks') ";
$result = mysql_query($query,$dblink);


}

$query1= "UPDATE event SET status= '$status' where id=$id ";
$result1 = mysql_query($query1,$dblink);

?>


Link to comment
https://forums.phpfreaks.com/topic/196934-help-with-null/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.