Question: I have made a simple chat application in PHP/Ajax/MySQL. 

I am regularly calling these two methods-

```
setInterval("GetChatParticipants()",5000);
setInterval("GetChatMessages()",1000);

```

Now as per client design, there's no Logout or Sign Out button, so I want to detect when user closes the browser and at that time I have to delete the participant record from the database. I dont want to use `onbeforeunload` as Chrome refuses to accept Ajax requests on window unload event.

So I am thinking of implementing in Ajax by making repeated reqests. But the question is how exactly shall I do that. Shall I update the Participant table with `last_active_time` and if the difference between current time and that `last_active_time` is , say, more than 10 min, then I should delete the user? Is it a practical solution or could there be a better one?

Answer: 
The [Choosing an API](http://es.php.net/manual/en/mysqlinfo.api.choosing.php) chapter in the PHP manual says this:

> 
> The overall
>  performance of all three extensions is considered to be about the
>  same. Although the performance of the extension contributes only a
>  fraction of the total run time of a PHP web request. Often, the impact
>  is as low as 0.1%.
> 
> 
> 

To sum up: if performance is your only concern, it's irrelevant which one you choose. (Not to mention that database size or complexity is basically MySQL Server's problem.)
In my opinion PDO is better than mysqli and there are no doubts. There are support for another databases, named parameters, easier SQL-Injection security (using prepared statements). 

Mysqli is slightly faster, but i think it cannot be main reason in this case.