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
8
Other forums
Mouseover to edit (Ajax)
hi friends, can anyone help with the code behind to get this application working, please in VB (new
Recognising Revenue daily
Hello.
Has anyone come across daily recognition of deferred income?
We want to implement R
CURL question
i am wondering if it's possible to use multi curl with login something like
login once to web
Getting PHP to ammended the selected in option field
Hey Guys
thanks for everyones help so far. This site and its users are oozing awesomness.
Help With editting and deleting form
Hallo !!
So look at this image :
http://img194.imageshack.us/img194/8272/snapshot5f.pn
Why do I get this error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a5488351/public_html/b
Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:
2010-01-26 and 2010-05-30
Something Non-Traditional. Can we solve?
I have an idea for an application here. It's mostly flash, but it couldn't work without a somewhat n
phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:
Code: [Select]$mailer = new PHPMailer();
$mailer-&
having probem inserting data into db table
hi
i have a table with following columns in it
Code: candidate_id, degree, cgpa, institute