Jump to content

Recommended Posts

Hi guys im tryin to write a script that will delete multiple files from a database using check boxes

Here 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 10

I pretty sure my code is missing some crucial parts so if anyone has any suggestions please help!!

thanks
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.