I have a page called viewdb.php that displays images and articles that I posted. Along with the image and article there is a radio select button that is displayed with each article posted.
<input name="id" type="radio" value="id">
well the idea is to select an article by way of the radio button and then choose an option of an update, delete or view button.
my delete button points to this page called delete.php with the following code:
<?php
$id= "id";
$db = mysql_connect("localhost", "***", "***"
;
mysql_select_db("userdb",$db);
mysql_query("DELETE FROM Portfolio WHERE id=$id LIMIT 1",$db);
echo "Information Deleted";
?>
the button that points to the delete page is not a submit button so it does not use a form element. it is a regular button with a tag that directs you to a the delete page with the obove delete code. the idea is to know what article I selected and allow me to update, delete or view that article.
my problem is that when I hit delete it deletes all of my articles not just the one I selected, and if I add the LIMIT 1 to the script then it only deletes 1 article but not the selected one, it deletes the first article displayed on the page.
does anybody have any idea how I can get this working correctly?
Thanks in advance.
Max
Nothing is hard when you realy want to learn it.
Max
<input name="id" type="radio" value="id">
well the idea is to select an article by way of the radio button and then choose an option of an update, delete or view button.
my delete button points to this page called delete.php with the following code:
<?php
$id= "id";
$db = mysql_connect("localhost", "***", "***"

mysql_select_db("userdb",$db);
mysql_query("DELETE FROM Portfolio WHERE id=$id LIMIT 1",$db);
echo "Information Deleted";
?>
the button that points to the delete page is not a submit button so it does not use a form element. it is a regular button with a tag that directs you to a the delete page with the obove delete code. the idea is to know what article I selected and allow me to update, delete or view that article.
my problem is that when I hit delete it deletes all of my articles not just the one I selected, and if I add the LIMIT 1 to the script then it only deletes 1 article but not the selected one, it deletes the first article displayed on the page.
does anybody have any idea how I can get this working correctly?
Thanks in advance.
Max
Nothing is hard when you realy want to learn it.
Max