Jump to content

$_GET Problem


smithmr8

Recommended Posts

This script is supposed to list and news items from a table where the recipent ID is the same as the account ID which is looking at it. This part works fine. I am having difficulty with a delete command I have added to it.

 

<?php
$temprow = mysql_query("SELECT * FROM office WHERE recipent = $x[iD]");
$num_rows_temp = mysql_num_rows($temprow);

if ($num_rows_temp >= 1) {
$data = mysql_query("SELECT * FROM office")
or die(mysql_error());

while($info = mysql_fetch_array( $data ))
{
$ID = $info['ID'];
echo $info['time']." | ".$info['message']." [<a href=officenews.php?remove=$ID>Delete</a>]<br>";
}
} else {
print "<i>You haven't got any news.</i>";
}


if (isset($_GET['remove']) && is_numeric($_GET['id'])) {
$id = $_GET['id'];
//echo "Working";
  
  mysql_query("DELETE FROM office WHERE ID='$id'") or die("Error With News Removal, /$/result");
print "News Item Deleted";
} else {
echo "<br><font color=FF0000>Something not right</font>";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.