DELETE FROM `reset_codes` WHERE `reset_code` = 'nonexistantvalue'
Deleting nothing
- FrederickGeek8
- Posts: 148
- Joined: Wed Nov 30, 2011 10:31 pm
Deleting nothing
If it ok if I'm running a query that is determined by a $_GET variables that deleted from a table, even if there is nothing there? Like if I run this query it runs fine (no errors) but I'm wondering if there is any downside to using it
Re: Deleting nothing
Well, it's wasted computing power. But I don't think it's harmful if thats what you mean.
- FrederickGeek8
- Posts: 148
- Joined: Wed Nov 30, 2011 10:31 pm
Re: Deleting nothing
OK. I would think that it would be more wasteful if I did
$total = mysql_query("SELECT COUNT(`user_id`) FROM `reset_codes` WHERE `reset_code` = '{$reset_id}'"); if($mysql_result($total, 0) == '1'){ mysql_query("DELETE FROM `reset_codes` WHERE `reset_code` = '{$reset_id}'"); }else{ $errors[] = 'Invalid reset code.'; }I think I'm going to stick with the way it is. The only thing I was worried about was security (not that things weren't sanitized, it just felt weird that a user directly hooked into a db)