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? 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? 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. 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 ? 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
Archived
This topic is now archived and is closed to further replies.