PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Apon logout I am tyring to get the script to reset a mysql field back to the default value, so when people logout there username is droped from the logged in members list:
a better method would be to alter the field to hold a DEFAULT value. This means that if you issue an INSERT command or UPDATE to a field with nothing in it, it would resort to what you set as default.
Yea I tried that .. But it seems to keep holding a time value .. the time gets inserted everytime there is a page change .. But once the logout happens they are sent to a page that doesnt includes session_start() .. so when the logout script runs the field should be reset to default value .. It isnt updated untill the login process happens in which that field is then updated using now() .. So I pretty sure that on logout, the field is not being reset back to the default value .. with any of the above posted codes ..
I allready have a default and also the query is run before the session is destroyed .. as you will see in the original post ..
.. the online_status is being read from a field within the users table .. Can you just delete a single field? .. I cant delete the entire record as all the users data is held in it.
Maybe I should be using a seperate table?
Thanks
Last edited by Jim_Bo on Thu Mar 31, 2005 1:22 am, edited 1 time in total.
Considering you are updating that particular field all the time, your database may perform better if it was in a seperate table. One designed for higher activity (less fields, simple types and stuff). I don't know about other database table storage types, but mysql has 'heap' among other types.
On forums like this one etc .. how is the guest online, members online etc handled .. would it all be held in a single table ..
I have guest/members & total visits in one table .. and basically using the datetime method from the users table to get the members who are active online to display the user_name on the webpage ..?
phpbb uses a single table for all users online, guest and members alike. User data is only for members, so that data is stored in its own table. There's a user for guests that all guests share though, mostly to store the basic starting information for a user on the system.
I allready have a default and also the query is run before the session is destroyed .. as you will see in the original post ..
.. the online_status is being read from a field within the users table .. Can you just delete a single field? .. I cant delete the entire record as all the users data is held in it.
Maybe I should be using a seperate table?
Thanks
if you already have a default and set it up like i showed you, there is no reason why that when you send a blank value for that field that it doesn't fill it with the default value...