EchoFool Posted January 18, 2008 Share Posted January 18, 2008 Is there a way to check that my query has actually deleted a row. I cannot tell for sure if its being deleted and then re-created. Is there like a check for affected rows or something? I have this: $GetFight = ("DELETE FROM attack WHERE Attacker='{$_SESSION['Current_User']}'") Or die(mysql_error()); And it doesn't delete my row. It's quite irritating as i do not know why. Hope you can help. Quote Link to comment https://forums.phpfreaks.com/topic/86575-solved-query-affected-rows/ Share on other sites More sharing options...
pocobueno1388 Posted January 18, 2008 Share Posted January 18, 2008 Your not using mysql_query. Change your code to this: <?php $GetFight = mysql_query("DELETE FROM attack WHERE Attacker='{$_SESSION['Current_User']}'") or die(mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/86575-solved-query-affected-rows/#findComment-442349 Share on other sites More sharing options...
EchoFool Posted January 18, 2008 Author Share Posted January 18, 2008 LOL man thats got to be a sign that i need a break! Good spot. Can't believe i didn't see that. Thankyou! Quote Link to comment https://forums.phpfreaks.com/topic/86575-solved-query-affected-rows/#findComment-442351 Share on other sites More sharing options...
teng84 Posted January 18, 2008 Share Posted January 18, 2008 $GetFight = mysql_query("DELETE FROM attack WHERE Attacker='{$_SESSION['Current_User']}'") or die(mysql_error()); if($GetFight ){ //yes }else{ //no } echo msql_affected_rows($GetFight);//returns the number of affected rows pocobueno1388 beat me Quote Link to comment https://forums.phpfreaks.com/topic/86575-solved-query-affected-rows/#findComment-442352 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.