is id been used as an auto increment integer ?
Try
$jobapp_toDB = mysql_query("INSERT INTO jobApplications (date, candID, jobID) VALUES ('$appdate', $candID, $jobID)")
or die("failed=yes");
Check the date is correctly formatted if you're putting it in a date field, also I'm guessing $candID and jobID are supposed to be integers so you need to make sure they are valid.
In fact:
PHP Code:
$adddate = $_GET['date'];
$jobID = $_GET['userID'];
$candID = $_GET['candID'];
settype($jobID, "integer");
settype($candID, "integer");
$query = sprintf("INSERT INTO jobApplications (date, candID, jobID) VALUES ('%s', %d, %d)", addslashes($adddate), $jobID, $candID);
$jobapp_toDB = mysql_query($query) or die "failed=yes";
You should really add in some code before building the query to make sure the data is valid too, e.g. is userID a valid integer for my app e.g. > 0 and the same for candID.
By splitting the query off you can easily echo back what the query is so you can test it directly in the database to get the database error thats stopping it running, and you are formatting the input removing some potential sql injection problems.
Is adddate the current date ? if so you don't need to pass it and you could use
$query = sprintf("INSERT INTO jobApplications (date, candID, jobID) VALUES (CURDATE(), %d, %d)", $jobID, $candID);
Social Networking Bookmarks