0

So I have one page that basically reads the entries I have from my table and out puts them with a link around the date so that when clicked your supposed to be able to delete it. Problem is when I click the link nothing happens. Heres the code for the page that lists the table.

//fetch from db
				$fetch = mysql_query("SELECT * FROM news ORDER BY id DESC",$link) OR DIE(mysql_error());
					if(mysql_numrows($fetch) < 1) {
						echo "<br /><br />No News.<br /><br />";
					}
					else {
						echo "<h3>News</h3><small>From newest to oldest. Click News Title to Delete.</small>";

						$r_count = 0;
						$c_1 = "c_1";
						$c_2 = "c_2";

						print "<table id=\"regs\">";			
							while($display=mysql_fetch_assoc($fetch)) {
								extract($display);
								
								$r_color = ($r_count % 2) ? $c_1 : $c_2 ;

								print "<tr class=\"".$r_color."\">";
								print 
									"<tr><td>".$newstitle."</td><td><a href=\"del.php?action=delnews&rid=".$id."\">".$newsdatetime."</a></td></tr>";
								print "</tr>";						
								$r_count++;
							}
						print "</table>";
					}

I have another page that includes the delete functions for all of my pages. Here is the code part of that file that corresponds to this page.

else if ($action == "delnews") {
	if ($rid != "") {
		if ($confirm == "") {
			$sql = mysql_query("SELECT * FROM news WHERE id='$rid' ",$link);
			while($disp=mysql_fetch_assoc($sql)) {
			extract($disp);

			echo "<p><b>Delete $newstitle?</b></p>";
	
			echo "<a href=\"?action=del&rid=".$id."&confirm=yes\">Yes</a><br /><a href=\"javascript:history.go(-1);\">No, return to add news page.</a>";
			}
		}
		else if($confirm=="yes") {
			//proceed deleting
			$sql="DELETE from news WHERE id='$rid'";
			$result=mysql_query($sql);

			if($result){
			echo "<h3>Deleted!</h3><p><a href=\"viewplayerprofiles.php\">Return to add news page.</a></p>";
			}
			else {
			echo "<h3>ERROR</h3>";
			adminindex();
			}
		}
		else {
			echo "<h3>error</h3>";
			adminindex();
		}
	}
}

When I click the link on the first page which is supposed to bring me to a confirmation page asking if I want to delete the entry, instead I get brought to a blank page with this in the address bar.

http://www.website.com/TEST/admin/del.php?action=delnews&rid=1
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.