Jump to content

Archived

This topic is now archived and is closed to further replies.

dark dude

A Timestamp Wtf

Recommended Posts

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\" /]

Share this post


Link to post
Share on other sites
I think you need to the place date in the perenthesis like so:
UNIX_TIMESTAMP(NOW())

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Wow! Thanks very much! I've been to 4 different forums/help teams, and they all havent helped, but you have ^_^

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.