abdfahim Posted November 5, 2009 Share Posted November 5, 2009 When I use REPLACE command, is there any single command by which I can show how many rows are affected? If I use mysql_updated_rows(), it will show correctly if no rows are replaced, but if some rows are replaced, it shows double count (obviously, according to how the function works). So, is there any function which show me exactly how many records are updated/inserted? Quote Link to comment https://forums.phpfreaks.com/topic/180380-how-to-show-number-of-rows-affectedinserted/ Share on other sites More sharing options...
Mchl Posted November 5, 2009 Share Posted November 5, 2009 Divide the result by 2? Quote Link to comment https://forums.phpfreaks.com/topic/180380-how-to-show-number-of-rows-affectedinserted/#findComment-951614 Share on other sites More sharing options...
abdfahim Posted November 5, 2009 Author Share Posted November 5, 2009 Divide the result by 2? I cant do that because it'll show half count if nothing was replaced, all are new record. Just remember, I dont know whether the data are replacing or inserting, and that's why I opt for REPLACE, not INSERT. Quote Link to comment https://forums.phpfreaks.com/topic/180380-how-to-show-number-of-rows-affectedinserted/#findComment-951623 Share on other sites More sharing options...
Mchl Posted November 5, 2009 Share Posted November 5, 2009 Maybe you should go with INSERT ... ON DUPLICATE KEY UPDATE ? Quote Link to comment https://forums.phpfreaks.com/topic/180380-how-to-show-number-of-rows-affectedinserted/#findComment-951657 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.