If Selected Insert Into Database

Discussion in 'PHP' started by !Unreal, Feb 20, 2009.

  1. #1
    Ive got a basic moderation script to create but Im stuck as to how to do it because there would be too much data to transfer as post data.

    So heres the premise

     	 		 			 $result = mysql_query("SELECT * FROM whatstobemoderated"); 
    
    while($row = mysql_fetch_array($result))
      {
      echo '<input type="checkbox" name="url">' . linkify($row['url']);
      echo "<br />";
      }  
    
    PHP:

    If the box is checked I want it to be sent to another table then deleted from this one. If its not checked I want it to be deleted.

    How would I do this? Thanks [​IMG]
     
    !Unreal, Feb 20, 2009 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    name URL as URL[ID] and use this in a single line to remove stuff from your database

    like

    mysql_query("DELETE FROM table WHERE id IN ('" . implode("','", $_POST['url']) . "')";

    hope this helps you! :)
     
    EricBruggema, Feb 24, 2009 IP