Jump to content

Recommended Posts

Hello, Whenever I store an output from Date(YmdGi); into my mysql database. It always comes up as the same number...

 

E.G: My database looks like this

 

Timestamp        |  Username

 

2147483647          John

2147483647          Jack

2147483647          Peter

 

Here is my script:

 


// $username = Form data

$timestamp = date(YmdGi);

echo "$timestamp";

$result ("INSERT INTO users (timestamp, username) VALUES ('$timestamp', '$username')");

 

When I run this script it outputs something like 200703251056 but then in the database its always that same number....

 

What am i doing wrong?

 

- Cheers, Daniel

Link to comment
https://forums.phpfreaks.com/topic/44182-date-and-mysql/
Share on other sites

For a users online script useing the UNIX_TIMESTAMP();

put this in the page where it logs the time of the user:

mysql_query("UPDATE `tablename` SET `last_online`=UNIX_TIMESTAMP() WHERE `mid`='$id'");

 

The users online script itself:

$names = mysql_query("SELECT `name` FROM `tablename` WHERE `last_online`=UNIX_TIMESTAMP()-300"); //simple calculation 60*5 = 300
echo $names;

Link to comment
https://forums.phpfreaks.com/topic/44182-date-and-mysql/#findComment-214552
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.