aebstract Posted June 17, 2006 Share Posted June 17, 2006 I'm trying to get it to delete every row that has a certain number in a certain column, so I need to run a while for that number in that column, but there could be any number of them so I'm not sure exactly how to do it. Any help in a direction to go with this would be great.edit: solved with:[code]} elseif ($action == deleteall){$result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id'"); while($r=mysql_fetch_array($result)) { mysql_query("DELETE FROM pmbox WHERE recieverid = '$id'"); }}[/code] Link to comment https://forums.phpfreaks.com/topic/12235-quick-help-with-while-loop/ Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 why not do it this way.database connectionselect staementwhile loopif($the_colum > 0) {delete } Link to comment https://forums.phpfreaks.com/topic/12235-quick-help-with-while-loop/#findComment-46642 Share on other sites More sharing options...
AndyB Posted June 17, 2006 Share Posted June 17, 2006 [code]} elseif ($action == "deleteall") { mysql_query("DELETE * FROM pmbox WHERE recieverid = '$id'"); } [/code] Link to comment https://forums.phpfreaks.com/topic/12235-quick-help-with-while-loop/#findComment-46651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.