I have a mysql table with the following 2 data fields
…
regdate
date NOT NULL,
regip
varchar(30) NOT NULL default ‘’,
.,.,
Is this the correct way to capture both the current date (YYYY-MM-DD) and the IP address.
$date = curdate();
$ip = $_SERVER['REMOTE_ADDR'];
or is this a good way to caapture the current datew
$date = date("Ymd");
zbap
3
lukeurtnowski, MySQL expects its dates to be formatted yyyy-mm-dd. Because of this you’re going to have to format the date for input. For example:
$date = date(“Y-m-d”);
$ip = $_SERVER[‘REMOTE_ADDR’];
echo $date;
echo $ip;
//create sql query for insert
Best of luck.