Jump to content

help with decision making...


DanDaBeginner

Recommended Posts

:-\ it seems that nobody are visiting the mysql help and thats whhy I posted it here.. sorry guys!

I made a chat that enables user to create a room with php,mysql,AJAX...

now my questio is:

 

I dont want to populate my table so what I did is instead inserting for every message in the table, what I did is Update for each room...am I right on this one? and also I deleted the room in the table when the creator of that room has no active activity or if the creator logsout? am I right on this one? or maybe delete the room if the room has no activity for about 1hour? what is the best.. nedd advice please..

 

thanx

Dan

Link to comment
https://forums.phpfreaks.com/topic/47688-help-with-decision-making/
Share on other sites

Hm, not sure really.

 

I would have a cron job that runs every minute that cleans out old messages from the database.

 

You can use a PHP script as the cron job.

 

Every message needs a time stamp (which I guess you are already doing) then delete those messages that are more than 3 days old.

 

You will have to keep an eye on the size of the database, if 1,000,000s of people are posting messages all day, then you may need to shorten the age of the messages so they get deleted sooner.

 

Does that help?

 

monk.e.boy

:D thanx man... so its not a good idea to overwrite old message with the new message? instead of updating the row for that room, I can, maybe insert for every message then clean up afterwrads?

ANYONE PLEASE!!!!

 

 

and also when two user click's  the send button at the same time (accidentally, you will never know!), is there a possibility that they going to have a the same timestamp?

 

 

bump for suggestion please... thanx in advance..

 

and also is there a chance that both user click the send button at the same time accidentally and save it to dbase, would they have the same timestamp?what I think is that they will not have the same timestamp, because mysql locks the insert while waiting for the first insert to be finish..am I right?

:) hi guys! bump for more please......thanx!

and also is there a chance that both user click the send button at the same time accidentally and save it to dbase, would they have the same timestamp?what I think is that they will not have the same timestamp, because mysql locks the insert while waiting for the first insert to be finish..am I right?

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.