ShoeLace1291 Posted June 12, 2007 Share Posted June 12, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/55194-question/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.