delete more ten 1 item

Links for php scripts

Moderators: macek, egami, gesf

nishaeas
New php-forum User
New php-forum User
Posts: 12
Joined: Mon Jul 10, 2006 6:35 pm

delete more ten 1 item

Postby nishaeas » Tue Jul 11, 2006 12:12 am

guys can u help me by editin tis coddin.

<?php
$id = $_POST['id'];


mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("eraccdb") or die(mysql_error());

// Insert a row of information into the table "complaint"
mysql_query("DELETE FROM complaint Where
id='$id'")
or die(mysql_error());
?>
<?
$result = mysql_query("SELECT * FROM complaint")
or die(mysql_error());

echo "<table border='1'>";
echo "<tr><th>id</th> <th>name</th> <th>age</th> <th>race</th> <th>nric</th> <th>address</th> <th>address2</th> <th>city</th> <th>postcode</th> <th>state</th> <th>home</th> <th>email</th> <th>mobile</th> <th>office</th> <th>date</th> <th>type</th> <th>enquiry</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['id'];
echo "</td><td>";
echo $row['name'];
echo "</td><td>";
echo $row['age'];
echo "</td><td>";
echo $row['race'];
echo "</td><td>";
echo $row['nric'];
echo "</td><td>";
echo $row['address'];
echo "</td><td>";
echo $row['address2'];
echo "</td><td>";
echo $row['city'];
echo "</td><td>";
echo $row['postcode'];
echo "</td><td>";
echo $row['state'];
echo "</td><td>";
echo $row['home'];
echo "</td><td>";
echo $row['email'];
echo "</td><td>";
echo $row['mobile'];
echo "</td><td>";
echo $row['office'];
echo "</td><td>";
echo $row['date'];
echo "</td><td>";
echo $row['type'];
echo "</td><td>";
echo $row['enquiry'];
echo "</td>";
}
echo "</table>";

?>

this is coddin for delete function of 1 item.how to do delete more then 1 item at the same time

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Thu Jul 13, 2006 6:08 pm

Please don't cross posts!
Already answered here!


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest