Jump to content

[SOLVED]Multiple delete files from database


joebudden

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

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.