SELECT MAX(a_id) AS Maxa_id FROM forum_answer1Incorrect integer value: '' for column 'question_id' at row 1
if i remove the echo $sql..this will be the error
1Incorrect integer value: '' for column 'question_id' at row 1
Moderator: General Moderators
SELECT MAX(a_id) AS Maxa_id FROM forum_answer1Incorrect integer value: '' for column 'question_id' at row 1
1Incorrect integer value: '' for column 'question_id' at row 1
Code: Select all
$sql2="INSERT INTO forum_answer(question_id,a_id,a_name,a_email,a_answer,a_datetime)
VALUES($id,'$Max_id','$a_name','$a_email','$a_answer','$datetime')";social experiment my question_id is not auto increment.. but the default value is null
1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ','1','claire','@yahoo','what?? ','01/06/12 11:17:24')' at line 2
Code: Select all
$id=$_POST['id'];
Code: Select all
$sql2="INSERT INTO forum_answer(question_id,a_id,a_name,a_email,a_answer,a_datetime)
VALUES($id,'$Max_id','$a_name','$a_email','$a_answer','$datetime')";
$result2=mysql_query($sql2) or die (mysql_error());
No the default value shouldn't be null;sophie wrote:so i will change the default value to "null"? .. i will give it a try..
What value do you get for $id ($_POST['id']) if echoed to the browser?social_experiment wrote:The default value could be the problem; I created a table and set one of the columns to INT(4) and the default value of the column to 'NULL' and got an error message about it, before i inserted any data.