Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert date into Mysql

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
I have this piece of code and would like to insert a date value to the database, but it keeps writing a string of zeros.

$query = "INSERT INTO Competition VALUES('','$MobileNumber','$RefNo','$KeyWord','NOW()','$Message')";
i have tried using this as well but not inserting even though its echoing the date
$today = localtime();
$today[4] +=1;
$today[5] +=1900;
$PinDate = "$today[3]/$today[4]/$today[5]";
echo "Today is ". $PinDate;

Does anyone know what im doing wrong.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top