Jump to content


quick help with while loop

  • Please log in to reply
2 replies to this topic

#1 aebstract

  • Members
  • PipPipPip
  • Advanced Member
  • 1,105 posts

Posted 17 June 2006 - 01:22 PM

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:

} 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'");             

There is an area of the mind that could be called unsane, beyond sanity, and yet
not insane. Think of a circle with a fine split in it. At one end there's
insanity. You go around the circle to sanity, and on the other end of the
circle, close to insanity, but not insanity, is unsanity.

#2 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 01:32 PM

why not do it this way.

database connection

select staement

while loop

if($the_colum > 0) {



Wish i new all about php DAM i will have to learn

#3 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 17 June 2006 - 02:03 PM

} elseif ($action == "deleteall") {
    mysql_query("DELETE * FROM pmbox WHERE recieverid = '$id'");             

Legend has it that reading the manual never killed anyone.
My site

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users