smithmr8 Posted February 18, 2008 Share Posted February 18, 2008 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 More sharing options...
trq Posted February 18, 2008 Share Posted February 18, 2008 The difficulty being? Link to comment https://forums.phpfreaks.com/topic/91670-_get-problem/#findComment-469503 Share on other sites More sharing options...
aschk Posted February 18, 2008 Share Posted February 18, 2008 My worry is that the following line will b0rk because of the $ in it. <?php ...die("Error With News Removal, /$/result"); ?> Link to comment https://forums.phpfreaks.com/topic/91670-_get-problem/#findComment-469515 Share on other sites More sharing options...
uniflare Posted February 18, 2008 Share Posted February 18, 2008 are you trying to escape the $ character so its including the data from $result, if so this line should be: die("Error With News Removal, \$result"); or you could use: die('Error With News Removal, $result'); Link to comment https://forums.phpfreaks.com/topic/91670-_get-problem/#findComment-469517 Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 you dont need the $ it only for you to see a error in your code should use mysql_error() function/command........ the error message shouldnt be used for users to see it for you to correct coding problams... Link to comment https://forums.phpfreaks.com/topic/91670-_get-problem/#findComment-469518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.