dark dude Posted June 26, 2006 Share Posted June 26, 2006 Ok, I've been in need of timestamps, and all was going well, but for some reason, it doesnt like to put the timestamp onto my database...Look at my script:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<? session_start(); ?> <body bgcolor='#000033' text='#CCFFFF'> <? $Username = $_SESSION['Username']; $Reciever=$_POST['Reciever']; $Type=$_POST['Type']; $Subject=$_POST['Subject']; $MessageBody=$_POST['MessageBody']; include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT * FROM Users WHERE Username='$Reciever'";$result = mysql_query($query) or die(mysql_error());$Username3=mysql_result($result,$i,"Username");$quotes_array = file('gamemods.txt'); if($Username3==''){echo "The Reciepant does not exist!";}else {if($Type=="Report"){$quote = $quotes_array[rand(0, count($quotes_array) - 1)]; $quote = trim($quote); $query = "INSERT INTO Messages VALUES ('',UNIX_TIMESTAMP(),'$Username','$quote','$Subject','$MessageBody','$Type')";mysql_query($query); } else { $query = "INSERT INTO Messages VALUES ('',UNIX_TIMESTAMP(),'$Username','$Reciever','$Subject','$MessageBody','$Type')";mysql_query($query); } mysql_close(); ?> Your <? if($Type=="Report"){ echo "Report "; } elseif($Type=="PM"){ echo "Private Message ";} elseif($Type=="SPM"){echo "Anonymous Private Message (This type of Private Message is not shown in Mod Message logs) ";}else{ echo "$Type "; } ?> has been sent!<br><br> Please note that Reports are automatically sent to Game Moderators to prevent confusion. <?}[/quote]Everything seems to be ok, but look what happens when I go through the script:[a href=\"http://img327.imageshack.us/img327/1303/tsprob1nf.png\" target=\"_blank\"]http://img327.imageshack.us/img327/1303/tsprob1nf.png[/a]Incase you needed to know, here's the databases settings that it goes to:[a href=\"http://img288.imageshack.us/img288/7987/fissue5nv.png\" target=\"_blank\"]http://img288.imageshack.us/img288/7987/fissue5nv.png[/a]Any help that works will be much appreciated [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/12944-a-timestamp-wtf/ Share on other sites More sharing options...
wildteen88 Posted June 26, 2006 Share Posted June 26, 2006 I think you need to the place date in the perenthesis like so:UNIX_TIMESTAMP(NOW()) Quote Link to comment https://forums.phpfreaks.com/topic/12944-a-timestamp-wtf/#findComment-49712 Share on other sites More sharing options...
fractil Posted June 26, 2006 Share Posted June 26, 2006 I believe you can just use NOW().See: [a href=\"http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html[/a]Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/12944-a-timestamp-wtf/#findComment-49715 Share on other sites More sharing options...
dark dude Posted June 26, 2006 Author Share Posted June 26, 2006 Wow! Thanks very much! I've been to 4 different forums/help teams, and they all havent helped, but you have ^_^ Quote Link to comment https://forums.phpfreaks.com/topic/12944-a-timestamp-wtf/#findComment-49726 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.