This is the second time today debugging, that the mysql_query INSERT statement has given me major problems.
$username = mysql_real_escape_string($_SESSION['username']);
$type = $_GET['type'];
$title = $_GET['title'];
$activitytype = $_GET['activitytype'];
$desc = $_GET['desc'];
$thedate = $_GET['deadline'];
$amtppl = $_GET['amtpeople'];
So, all the variables are correct (as echoed by my own console), so it’s purely based on mysql INSERT statement again.
mysql_query(" INSERT INTO activity
(`username`, `title`, `details`, `datetime`, `people`, `activitytype`)
VALUES ('$username', '$title', '$desc', '$thedate', '$amtppl', '$activitytype')");
Can anyone see what’s wrong with it here? The properties are all correct (Closely proof read each and every one).
Using mysql_error();
I get an error called:
Duplicate entry ‘0’ for key 1
Thanks a ton, Chris.
Seems you don’t have
auto incrementon yourprimary key. Please make itauto incrementOther wise for unique index you should get last insert id or max id of that column and assign last insert id +1 form unique key column i.e make it unique.