mcmuney Posted February 22, 2007 Share Posted February 22, 2007 I'm using the following script to update several tables within my database, it works but it doesn't show me a confirmation of any sort. What I would like to see is for it to show me how many rows were impacted, how can I do that? <? // SYNC TOP FRIENDS mysql_query("DELETE tab1 FROM `sc_my_top_friends` AS tab1 LEFT JOIN `sc_friend` AS tab2 ON tab1.friend_id = tab2.scf_id WHERE tab2.scf_id IS NULL") or die(mysql_error()); // SYNC FRIEND HISTORY mysql_query("DELETE tab1 FROM `sc_friend_history` AS tab1 LEFT JOIN `sc_friend` AS tab2 ON tab1.scf_id = tab2.scf_id WHERE tab2.scf_id IS NULL") or die(mysql_error()); // REMOVE DELETED MEMBER POLLS mysql_query("DELETE tab1 FROM `sc_polls` AS tab1 LEFT JOIN `sc_member` AS tab2 ON tab1.Author_id = tab2.scm_mem_id WHERE tab2.scm_mem_id IS NULL") or die(mysql_error()); // SYNC POLL DATA mysql_query("DELETE tab1 FROM `sc_polls_data` AS tab1 LEFT JOIN `sc_polls` AS tab2 ON tab1.poll_id = tab2.id WHERE tab2.id IS NULL") or die(mysql_error()); // REMOVE LOW RATINGS mysql_query("UPDATE `sc_rate_score` SET `rs_score` = '7' WHERE `rs_score` =1 LIMIT 1000") or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/39576-show-number-of-affected-rows/ Share on other sites More sharing options...
jcbarr Posted February 22, 2007 Share Posted February 22, 2007 http://us2.php.net/manual/en/function.mysql-affected-rows.php Link to comment https://forums.phpfreaks.com/topic/39576-show-number-of-affected-rows/#findComment-190947 Share on other sites More sharing options...
mcmuney Posted February 22, 2007 Author Share Posted February 22, 2007 Bingo!!! Thanks. Link to comment https://forums.phpfreaks.com/topic/39576-show-number-of-affected-rows/#findComment-190953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.