joebudden Posted January 8, 2007 Share Posted January 8, 2007 Hi guys im tryin to write a script that will delete multiple files from a database using check boxesHere is my code so far[code]<?php require("cw1/connect.php"); require("cw1/dbselect.php"); session_start(); $squery = mysql_query("select artefactId,filename from artefact order by artefactId desc"); $dquery = "delete from artefact where artefactId=?????????";//not quite sure what should go here // could i use IN ??? if ($_POST["delete"]) { $result = mysql_query($dquery); echo 'Files deleted'; echo '<p><a href="login.php"> Home </a></p>'; return; } echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'; echo '<table width="75%" border="1" cellspacing="0" cellpadding="0">'; echo '<tr><td width="20%"><b>ID</b><br /></td>'; echo '<td width="40%"><b>Filename</b></td>'; echo '<td width="20%"><b>Delete</b></td>'; if (mysql_num_rows($squery) !== 0) { while(list($artefactId,$filename) = mysql_fetch_array($squery)) { echo '<tr><td width="20%">'.$artefactId.'</td>'; echo '<td width="40%">'.$filename.'</td>'; echo '<td width="20%">'; echo '<input type="checkbox" name="deleted_items"'; echo 'value="'.$artefactId.'"/></td></tr>'; } } echo '</table>'; echo '<input type="submit" name="delete" value="Delete Selected" />'; echo '</form>'; echo '<p><a href="login.php"> Home </a></p>';?>[/code]At the moment I'm getting this error :Notice: Undefined index: delete in C:\p3t\public_php\cw\LINUX\multipledelete.php on line 10I pretty sure my code is missing some crucial parts so if anyone has any suggestions please help!!thanks Quote Link to comment https://forums.phpfreaks.com/topic/33289-solvedmultiple-delete-files-from-database/ Share on other sites More sharing options...
emehrkay Posted January 8, 2007 Share Posted January 8, 2007 do this echo '<pre>', print_r($_POST), '</pre>';that will tell you all of the post variables that you have availabe to you. if delete isnt in there, you arent passing it Quote Link to comment https://forums.phpfreaks.com/topic/33289-solvedmultiple-delete-files-from-database/#findComment-155546 Share on other sites More sharing options...
joebudden Posted January 8, 2007 Author Share Posted January 8, 2007 thanks iv sorted it now, how do i mark it as [SOLVED]?? Quote Link to comment https://forums.phpfreaks.com/topic/33289-solvedmultiple-delete-files-from-database/#findComment-155578 Share on other sites More sharing options...
Jessica Posted January 8, 2007 Share Posted January 8, 2007 Hit the solved button at the bottom.Or edit the title to say solved. Quote Link to comment https://forums.phpfreaks.com/topic/33289-solvedmultiple-delete-files-from-database/#findComment-155607 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.