I'm looking for a way to delete all items found in a php search.
Using a "show" script to pull up results for one field in a table.
Looking for something similar to what Yahoo Mail does, checkbox "Delete All"
and everything becomes checked and then deletes. Is there anything like that in php?
Any help greatly appreciated.
Heres the form
<form action="show-guard-search-
name.php" method="post"><font
size="2"><font size="2">Search by Name: <input
name="search1" type="text">
<input value="Search" type="submit">
</form>
Heres the php search script
<?
$user="howard42_root";
$password="blank";
$db_name="howard42_guard";
$table_name="guard";
$connection= @mysql_connect("localhost"
, $user, $password) or die(mysql_error());
$db= @mysql_select_db($db_name,
$connectio
n) or die(mysql_error());
$sql = "SELECT * FROM $table_name WHERE name LIKE '$_POST[search1]%'";
$result=mysql_query($sql);
$num=mysql_num_rows($resul
t);
mysql_close();
if ($num > 0) { // if it ran ok, display the records.
echo "<h5>Listing of Name Results </h5>";
echo "$num entrie(s) found";
echo " -
Catagory: Everything <a href=index.html><< Go Back</a> - <a href=search.html>Search Again</a>
<br><br>
<TABLE BORDER=1 valign=top cellspacing=7 cellpadding=7 width=80%>
<TR valign=top>
<td width=60%><FONT SIZE=2>Item</FONT></td><td
>Picture</
td>
</TR>
";
$i=0;
while ($i < $num) {
if ($i % 2) {
$color='#FFE3C4';
}else{
$color='#FFFFFF';
}
$id=mysql_result($result,$
i,"id");
$d1=mysql_result($result,$
i,"idate")
;
$d2=mysql_result($result,$
i,"nsn");
$d3=mysql_result($result,$
i,"name");
$d4=mysql_result($result,$
i,"qty");
$d5=mysql_result($result,$
i,"isu");
$d6=mysql_result($result,$
i,"shelf")
;
$d7=mysql_result($result,$
i,"picture
");
echo "<TR BGCOLOR=$color>
<TD valign=top width=60%><FONT SIZE=2><br>Entry Posted: $d1 </font><br><FONT SIZE=4>Nsn:<b>$d2</b> </FONT><br><br>Name: $d3 <br><br>Quantity: $d4 <br><br>ISU Container: $d5 <br><br>Shelf: $d6 </FONT></TD>
<td align=center valign=center><a href=$d7><img src=$d7 width=160px border=1></a> <br><font size=1> Path in Database: $d7 </font></td>
</TR>";
$i++;
}
} else { //If it did not run OK.
echo '<p class ="error">There are currently no results</p>';
}
?>
Start Free Trial