Jump to content

Archived

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

aebstract

quick help with while loop

Recommended Posts

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]

Share this post


Link to post
Share on other sites
why not do it this way.


database connection

select staement

while loop

if($the_colum > 0) {

delete

}

Share this post


Link to post
Share on other sites
[code]} elseif ($action == "deleteall") {
    mysql_query("DELETE * FROM pmbox WHERE recieverid = '$id'");            
} [/code]

Share this post


Link to post
Share on other sites

×

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.