I've been looking for an answer for some issues all afternoon. I finally got to this point...and can't find the answer (I think I'm going cross-eyed looking through all these questions/answers). I want to add the current date when someone adds their information. Here is the code I'm using:
$today = date("Y-m-d");
if (mysqli_connect_errno()) {
printf("Connect failed: %s/n", mysqli_connect_error());
exit();
} else {
$sql = "INSERT INTO faculty_mod1 (fname,lname,center,score1,date1)
VALUES ('".$_POST["fname"]."',
'".$_POST["lname"]."',
'".$_POST["center"]."',
'".$_POST["score1"]."',
'".$today["date1"]."')";
$res = mysqli_query($mysqli, $sql);
if ($res === TRUE) {
echo "A record has been inserted.";
} else {
printf("Could not insert record: %s\n", mysqli_error($mysqli));
}
mysqli_close($mysqli);
}
With this current set up I get this error: Could not insert record: Incorrect date value: '2' for column 'date1' at row 1 . Which is slightly differently from the "0" I was getting my doing the date as date("m-d-y");.
Thanks for any help...