Jump to content

Show Number of Affected Rows


mcmuney

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.