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
https://forums.phpfreaks.com/topic/91670-_get-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.