Jump to content

insert time


conan318

Recommended Posts

hi im trying to insert the username and time into the online table the trouble is nothing is getting inserted into the table no errors

have echoed both variables to check they contain the right information and they do.

$time=time();
echo $time;
echo $myusername;

$insert_user=mysql_query("INSERT INTO cvisinko_db.online (username,time,) VALUES ('$myusername','$time')") ;

 

then the plan is display a basic online list

haven't been able to test this as nothing is getting inserted into the online table

$data = mysql_query("SELECT count(*) from cvisinko_db.online WHERE `time` >= DATE_SUB(NOW(), INTERVAL 30 minute);") or die(mysql_error());

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/246671-insert-time/
Share on other sites

thats a neat little trick. but the result was the Query was empty which explains why nothing is being inserted into the database. but does  not explain why my query is empty

$time=time();
echo $time; // echo fine
echo $myusername; // fine

$insert_user=mysql_query("INSERT INTO cvisinko_db.online (username,time,) VALUES ('$myusername','$time')") ;
if( mysql_query($insert_user) == FALSE ) echo mysql_error();

Link to comment
https://forums.phpfreaks.com/topic/246671-insert-time/#findComment-1266646
Share on other sites

Archived

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

×
×
  • 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.