p8baller07 Posted August 25, 2009 Posted August 25, 2009 Okay so i'm trying to return all the values for "data" within the rows of a table with a delete button next to them. It all works so far, except the delete button doesnt delete mysql_select_db("alinco_alincosite", $con); $result = mysql_query("select * from news order by id desc"); $id = $_GET['ID']; if (isset($id)) { mysql_query("DELETE FROM news WHERE ID = '$id'"); echo "Post deleted!"; } while($r=mysql_fetch_array($result)) { echo $r["data"]; echo "<a href=\"?del=".$r['ID']."\">Delete</a><br />"; } Share this post Link to post Share on other sites More sharing options...
d3bruts1d Posted August 25, 2009 Posted August 25, 2009 You are telling it to get the value of ID from the query string, but that value isn't there. $id = $_GET['ID']; echo "<a href=\"?del=".$r['ID']."\">Delete</a><br />"; You should be able to either change the value in the $_GET or the query string value apended to the url. Share this post Link to post Share on other sites More sharing options...
p8baller07 Posted August 25, 2009 Posted August 25, 2009 You are telling it to get the value of ID from the query string, but that value isn't there. $id = $_GET['ID']; echo "<a href=\"?del=".$r['ID']."\">Delete</a><br />"; You should be able to either change the value in the $_GET or the query string value apended to the url. Is there a way to put the ID value in that query string? Share this post Link to post Share on other sites More sharing options...
d3bruts1d Posted August 25, 2009 Posted August 25, 2009 This should work... I'm got a migraine and cannot see clearly ATM... echo "<a href=\"?id=".$r['ID']."\">Delete</a><br />"; Share this post Link to post Share on other sites More sharing options...
p8baller07 Posted August 25, 2009 Posted August 25, 2009 This should work... I'm got a migraine and cannot see clearly ATM... echo "<a href=\"?id=".$r['ID']."\">Delete</a><br />"; That worked i just had to chang ?id= to ?ID= Thanks! Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now