Newbie - Help required with deleting records in database

Newbie - Help required with deleting records in database

am 17.05.2006 17:14:44 von Dynamo

Hi,
I'm still relatively new to php and sql and need some help with deleting records
from a database. My objective is to create a user friendly web page where I can
list all the records held within a database and have a check box by the side of
each record. Then I want all of those records where the check box is ticked to
be selected and deleted from the database. The coding I have below selects all
the records and inserts a check box by the side of each record. The check box
assumes the same name as the ID number of each record. Thats as far as I've got.
If someone could point me in the right direction for the rest of the coding
required to achieve my objective I would be extremely grateful.

$query = "SELECT * FROM Catalogue";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

// see if any rows were returned
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "

";
$r == 0;
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";




while($row = mysql_fetch_row($result)) {
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";

?>



echo "";
}
echo "
size='1' color='#FFFFCC'>Cat No size='1' color='#FFFFCC'>Click on the thumbnail to view a detailed
decscription
size='1' color='#FFFFCC'>Description size='1' color='#FFFFCC'>Price size='1' color='#FFFFCC'>Stock Availability size='1' color='#FFFFCC'>Postage and packaging size='1' color='#FFFFCC'>Delete this item

" . $row[0] .
"

src='/thumbnails/$row[2]'>

" . $row[3] .
"

£" . $row[6] .
"

" . $row[7] .
"

£" . $row[8] .
"

value='ON'>

";
}
else {
// no
// print status message
echo "No rows found!";
}

// free result set memory
mysql_free_result($result);

// close connection
mysql_close($connection);
?>

Thanks in advance
Dynamo


--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth

Re: Newbie - Help required with deleting records in database

am 19.05.2006 18:57:15 von unknown

Post removed (X-No-Archive: yes)