TonicPhp Posted June 22, 2011 Share Posted June 22, 2011 i basically update the time 'time()' on my databse when the user clicks submit and i want to take away the current time agaisnt the time stored in the database, $sql="SELECT time FROM test WHERE ID = 1" ; $sql2= mysql_query("$sql) ; $result = $sql-time(); this is what i tried but it dont work any help please Link to comment https://forums.phpfreaks.com/topic/240127-php-and-mysql-help/ Share on other sites More sharing options...
gristoi Posted June 22, 2011 Share Posted June 22, 2011 how is the time stored in the database? is it a datetime, or unix timestamp? Link to comment https://forums.phpfreaks.com/topic/240127-php-and-mysql-help/#findComment-1233441 Share on other sites More sharing options...
TonicPhp Posted June 24, 2011 Author Share Posted June 24, 2011 unix timestamp Link to comment https://forums.phpfreaks.com/topic/240127-php-and-mysql-help/#findComment-1234440 Share on other sites More sharing options...
Pikachu2000 Posted June 24, 2011 Share Posted June 24, 2011 $sql holds a mysql result resource, not a value. You need to get the value from the resource using one of the mysql_fetch_* functions, then perform the calculation. Link to comment https://forums.phpfreaks.com/topic/240127-php-and-mysql-help/#findComment-1234441 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.