check it,
i have this table
tablename: reports
id (AI)
content (varchar),
contentID (int),
checked (tinyint)
if (isset($_GET['reportPost'])){
$query = mysql_query("select * from reports where contentID = $_GET[reportPost]");
$report = mysql_fetch_assoc($query);
if (!mysql_num_rows($query) && $report['checked'] == 0) {
echo 'There is already a pending report on this object.';
} else {
header("Refresh: 2; url=showthread.php?id=$id");
echo '<div class="successMsg">Thanks for your report!</div>';
mysql_query("insert into reports...");
}
}
What i want to achieve with this code is that if theres already a record in reports with contentID = $_GET[reportPost] and is checked = 0 I dont want this to execute. The above code wont do it.
Some help would be much appriciated :)