Help Me/Question Storing The Time Difference In Database Table

PrashantD

Content Writer
Hi friends,

I'm having a tough time trying to figure this out because I want to store time in an array but it's turning out to be a bit more complicated because of the way this thing is set-up. I've included the code to make it easier to understand:

Code:
$result = $m->getAlliancePlayers ($this->allianceData['players_ids']); // Grabbed all player IDs that are in the alliance
$this->allianceData['players'] = array(); // Created an array for players who are in that alliance
while ( ($result != NULL && $result->next())) // If the result isn't NULL, grab data
{
   $this->allianceData['players'][] = array ( // Filling in the players array with data
			'id' => $result->row['id'],
			'name' => $result->row['name'],
			'total_people_count' => $result->row['total_people_count'],
			'alliance_roles' => $result->row['alliance_roles'],
			'villages_count' => $result->row['villages_count'],
			'lastLoginInSeconds' => $result->row[TIMESTAMPDIFF(SECOND, 'last_login_date', NOW()]
									   );
If you look at lastLoginInSeconds, I'm guessing I can't do that right? because I'm also pulling 'last_login_date' from the database. Basically my goal is to be able to store the time difference of the user from the time they last logged in to the current time and store it in the above array but not sure how I would do this. Any help will be appreciated. Thanks. :)
 
Top