Jump to content

Halp! PHP issues


p8baller07

Recommended Posts

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

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...