Comment Mod System Effects all rows...


Posted on 16th Feb 2014 07:03 pm by admin

Sorry if its confusing but here is whats going on: I have a table in a database called comments and there are alot of entries there but can manually be marked flagged with a 1. nevermind how that is done, but I made it so the comments are printed on a pass protected page with two links below them. Ignore is supposed to mark that comment with a 0, and delete deletes the row.

Everything works fine but the action happens to ALL the comments that are shown. Can anyone see why that is happening?

Did you know?Explore Trending and Topic pages for more stories like this.
Code: <?
if($session->isAdmin()){?>
<center><font face="Papyrus" size="5">MOD Center</font></center>
<center><a href='mod1.php'>[News Aproval]</a> <a href='mod2.php'>[Flagged Items]</a></center>
<?$con = mysql_connect("localhost","bmvybfbk_master","74SAc194G");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("bmvybfbk_website", $con);

$result = mysql_query("SELECT * FROM comments WHERE flagged = '1'");

while($row = mysql_fetch_array($result))

{
$cnumber = $row['id'];
echo $row['writer'] . " wrote:
" . $row['comment'];
echo "
<a href='mod2.php?action=ignore'>[Ignore]</a>";
echo " <a href='mod2.php?action=delcomment'>[Delete]</a>";
echo "
----------------------------------------------------------------------------------------------------
";


if ($action == ignore) {
mysql_query("UPDATE comments SET flagged = '0' WHERE id = '$cnumber' LIMIT 1");}

if ($action == delcomment) {mysql_query("DELETE FROM comments WHERE id='$cnumber' LIMIT1");}

else {echo " ";}

}
}else{ echo "*You Don't Have any rights to View this page*'"; } ?>
No comments posted yet

Your Answer:

Login to answer
114 Like 8 Dislike
Previous forums Next forums
Other forums

Unexpected T_Variable ?
Hi all,
I dont really know what I am doing!! I know I'm doing something wrong, and I know its on

How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.

H

php include email form with attachment
I have had no luck with finding a email form all over the Internet for various reasons. Some insecur

Run function every 5 mins ??
I have a function PostMessage()

How can I run it every 5 mins ??

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For

Sending an SMS Message with ASP.NET
Often times it may be a requirement for your web application to send an SMS message. Such examples w

IF STATEMENT HELP
Hi
i have created a calendar from a table:

Code: Calendar: October 2009
<table w

Question about ShowWindow()
Hello....

I'm struggling with sumpin, and I hope y'all can help.

I've got a CFormView

CRM?
I think that's what they're called. Customer Management System? Anyway. Is there any good free ones

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash