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?
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
New to mysqli library - Multiple query problem
Greetings,
I am writing a batch program that executes 3 queries on a single page. Using mysql
login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php
Batch Related Pricing
Hi, I need some clarity on the batch related pricing
For example the following are the b
problem when runing a funciton
I am trying to connect to database using a funciton in a functions.php
<?php
funct
gather checkbox data from form into email
Hello all,
First, i'd like to thank everyone who responded to my previous posts regarding set
Request.UrlReferrer
I need to make it so that a page can only be loaded when a button is clicked on a specific page. I d
Help: problem with Headers to download PDF file
Hi,
I'm trying to implement a script where when a user clicks a link he gets a PDF file to op
problem with array - multilingual page
this is my test page :
Code: <?php
if(isset($_GET['lang'])) {
if($_GET['la
calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same
Display error above the login forum help!
Hi guys. just so you know im not asking for someone to do this for me I just need to be pointed in t