trying to delete from a MySQL table
Posted: Tue Oct 09, 2007 6:21 am
feyd | Please use
and my form
i get no errors but the columns are not deleting.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
here is my codeCode: Select all
<?php
$con = mysql_connect('localhost', '******', '******');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ('roondog_gallery', $con);
mysql_query("DELETE FROM test WHERE picname=$_POST[remove]");
mysql_close($con);
?>Code: Select all
<html>
<head>
<style type="text/css">
img{
width: 100px;
height: 100px;
border: 1px solid black;
}
</style>
</head>
<body>
<?php
$con = mysql_connect('localhost', '******', '*****'}
mysql_select_db('roondog_gallery', $con);
$result = mysql_query("SELECT * FROM test");
while($row = mysql_fetch_array($result))
{
echo "<form action='picdelete.php' method='post'>";
echo "<img src='$row[picname]' />";
echo "<input type='checkbox' name='remove' value='$row[picname]' />";
}
echo "<input type='submit' value='delete picture' />";
echo "</form>";
if (mysql_rows_affected() => 1){
echo
?>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]