Re: Problem storing dates!
Quote
| year | int | NO | | 21 | |
| month | int(2) unsigned zerofill | NO | | 06 | |
| currentdate | varchar(10) | YES | | NULL | |
| surveyduedate | varchar(10) | YES | | NULL | |
1 Do
not store dates as varchars. Read the manual sections on date and time. Storing them as type
date is the only way to make date functions available to them.
2 Given a column `currentdate` of type date, `year` and `month` should be generated columns
Quote
$currentdate = $_POST['currentdate'];
echo nl2br("currentdate = $currentdate\n");
$sql = "INSERT INTO `orderform` (currentdate) VALUE ($currentdate)";
3 Read about SQL injection vulnerabilities. Either use prepared statements, or pass $_POST and $_GET values through mysqli_real_escape_string() (https://www.php.net/manual/en/mysqli.real-escape-string.php).
Edited 1 time(s). Last edit at 06/18/2021 10:08AM by Peter Brawley.
Subject
Written By
Posted
Re: Problem storing dates!
June 18, 2021 10:06AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.