jaikar Posted March 31, 2007 Share Posted March 31, 2007 hi, i need to insert a record in a table when ever a particular user clicks that link, to track if he clicked that link, that record should be inserted only once. when he clicks it again it should not insert, to do this i have 2 options listed below 1. make the select query and check if that particular record is available, if npt available insert the new record,.. if available, dont insert 2. delete the existing record and insert the new one. of the above 2 which will be faster if the records are so many .... according to the applications use, most of the time only a new record is inserted, its expected that most of the user will click the link only once. in some cases user may click the link more than once also. which one you will suggest.... please advise Thanks in advance Jaikar Link to comment https://forums.phpfreaks.com/topic/45023-need-your-suggestion-select-insert-or-delete-insert/ Share on other sites More sharing options...
Full-Demon Posted March 31, 2007 Share Posted March 31, 2007 Well, the select thingy can be pretty fast. If you indexed your table, and add LIMIT 1 at the end of the query, it should be really fast. But I guess it wont make a big difference, although I'd prefer the select tool. Because when you have to replace a row, it has to find it first anyway, and than hes going to replace it, while it doest have to replace it... And if most users only click once...not very sure about this, I never figured a site where I could view all statistics about whats faster etc... Full-Demon Link to comment https://forums.phpfreaks.com/topic/45023-need-your-suggestion-select-insert-or-delete-insert/#findComment-218580 Share on other sites More sharing options...
jaikar Posted March 31, 2007 Author Share Posted March 31, 2007 Thanks FD !... is there any more suggesion from others !..... ?... Thanks in advance ... Link to comment https://forums.phpfreaks.com/topic/45023-need-your-suggestion-select-insert-or-delete-insert/#findComment-218665 Share on other sites More sharing options...
jaikar Posted March 31, 2007 Author Share Posted March 31, 2007 bump Link to comment https://forums.phpfreaks.com/topic/45023-need-your-suggestion-select-insert-or-delete-insert/#findComment-218810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.