hi all,
when my codes ran at localhost, it doesnt have any error, however when it runs in a server it gives
'Column 'member_id' cannot be null'
//retrieve form data
$start_date=$_POST['start_date'];
$end_date=$_POST['end_date'];
$project_name=$_POST['project_name'];
$project_description=$_POST['project_description'];
// open connection
$link = mysqli_connect($host, $user, $pass, $db);
$query = "INSERT INTO project(project_name,start_date,end_date,project_description,project_status)VALUES('$project_name','$start_date','$end_date','$project_description','available')";
$result = mysqli_query($link, $query) or die(mysqli_error($link));
foreach ($_POST['trainers'] as $trainer) {
$query2 = "INSERT INTO trainer_schedule(project_id,member_id,trainer_reply,date)VALUES((SELECT project_id FROM project WHERE project_name='$project_name'),(SELECT member_id FROM member WHERE email='$trainer'),'Pending',NOW())";
$result2 = mysqli_query($link, $query2) or die(mysqli_error($link));
}
mysqli_close($link);
if ($result && $result2) {
$message = "<font size='3'>Project posted<font size='3' color='green'> Successfully</font></font><br />";
} else {
$message = "Project post <font size='3' color='red'>failed</font><br />";
$message .= "<a href='create_project.php'>try again</a>";
}
?>