MemphiS Posted January 8, 2008 Share Posted January 8, 2008 Is it better to INSERT() or to UPDATE() a table? Currently i use it with a cron job to update my sites statistics every 10 minutes. this means 144 INSERTS a day. Just wondering what others thoughts are that would know abit about this.. Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/ Share on other sites More sharing options...
Ken2k7 Posted January 8, 2008 Share Posted January 8, 2008 Uh...what do you mean? They're both different and what they do is pretty literal - Insert inserts a table row and Update updates a table row. What are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433239 Share on other sites More sharing options...
revraz Posted January 8, 2008 Share Posted January 8, 2008 INSERT inserts a new row/record. UPDATE updates an existing row/record. Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433240 Share on other sites More sharing options...
pocobueno1388 Posted January 8, 2008 Share Posted January 8, 2008 Inserting and Updating are completely different things, I don't even know why your debating which one to use, they both have a separate purpose. Give us more information on what your doing. Your saying your updating every 10 minutes, so what are your inserting? Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433241 Share on other sites More sharing options...
MemphiS Posted January 8, 2008 Author Share Posted January 8, 2008 Clearly i havent explained this well with those responces :| . All im asking is... Is it better to use an INSERT() or rather just UPDATE() the information. I update site statistics which i already said above. EG: how many users are currently registered. In total i have 25 columns. I could simply just go: mysql_query("UPDATE `table` SET `` = '' WHERE `` = ''"); or what im currently doing which is inserting a new row every 10 minutes. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433246 Share on other sites More sharing options...
Ken2k7 Posted January 8, 2008 Share Posted January 8, 2008 Clearly i havent explained this well with those responces :| . All im asking is... Is it better to use an INSERT() or rather just UPDATE() the information. I update site statistics which i already said above. EG: how many users are currently registered. In total i have 25 columns. I could simply just go: mysql_query("UPDATE `table` SET `` = '' WHERE `` = ''"); or what im currently doing which is inserting a new row every 10 minutes. :-\ Uh, I have no idea why you're confused on this. Key word: Logic. I think if you re-read what you just typed, you should know that you already answered your own question. Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433247 Share on other sites More sharing options...
MemphiS Posted January 8, 2008 Author Share Posted January 8, 2008 hmm mabey im just over thinking this then haha Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433250 Share on other sites More sharing options...
pocobueno1388 Posted January 8, 2008 Share Posted January 8, 2008 If your able to update a row in the database without doing anything else, then most likely you should do that. If you have to manipulate data around to insert a row, or it creates unneeded information, then thats not the way to go. Quote Link to comment https://forums.phpfreaks.com/topic/84962-solved-php-with-mysql/#findComment-433252 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.