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
Change snippet to use CURDATE
I am using time() in the snippet below, I would like to use CURDATE() and have the database setup fo
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
Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside
Call Screen statement Error
Dear Experts,
is there any setting that needs to be done before creating any dialog progr
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
IMAGE - SERVER SIDE scripting help...
How to receive pixel data of an image and buid a bitmap file on the server using the HTTP POST metho
Blank record injected into database
I always found several blank records inside my database, although $SESSION is required to insert the
Add User script "Could not execute query"
This should be an easy script but I can't get it to run. Can someone please help me?
<
Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.
Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per