Jump to content

Question


ShoeLace1291

Recommended Posts

I have a question about deleting database results.  In the past, I just use a button that takes a user to a "are you sure" page and it just deletes that result.  I now need a more efficient way of deleting database results since I will have alot more results showing.  I need to be able to delete more than one database result at one time.  I have seen scripts that delete results according to certain checkboxes that are checked.  I was wondering how I would do this if this was my current code:

 

 $query = mysql_query("SELECT sid,filename,is_private FROM recent_files WHERE userID = '$uid' ORDER BY sid DESC LIMIT 20") or die("Error: ".mysql_error());

echo "<table align='center' cellspacing='1' cellpadding='1' border='0' width='65%' style='background-color: #000000;'>
               <tr><form>
                    <td width='50%' style='background-color: #e4e4e4;'>Image</td><td width='50%' style='background-color: #e4e4e4;'>Delete?</td>
               </tr><tr>";

              while($fetch=mysql_fetch_array($query)){

              $sid=$fetch["sid"];
              $filename=$fetch["filename"];
              $is_private["is_private"];

              echo "<td width='50%' style='background-color: #e4e4e4;'>$filename<br><br><a href='image.php?img=$filename'><img src='uploads/$filename' alt='$filename' width='50' height='50' border='0'></a></td><td width='50%' style='background-color: #e4e4e4;'><input type='checkbox' name='delete$sid'></td>
               </tr>";

              }

echo "<td align='center' colspan='2'><input type='submit' value='Delete' name='submit'></form></table>";

 

Thanks in advance for any help that is provided.

Link to comment
https://forums.phpfreaks.com/topic/55194-question/
Share on other sites

Archived

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

×
×
  • Create New...

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.