I am making myself a tutorial management script for a tutorial site like good-tutorials. im sure everything works except the accept script, so if you know whats wrong please say, i will donate you some rep.
Thanks
Steven
Code:
Thanks
Steven
Code:
PHP:
<?php
error_reporting(E_ALL ^ E_NOTICE);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("tutorials");
$query = "SELECT url, id FROM tutorials WHERE status = 'no'";
$result = @mysql_query($query);
$num = mysql_num_rows ($result);
if ($num > 0) {
echo '<table>';
while ($row = mysql_fetch_array($result)) {
$id = $row[1];
echo "<tr>
<td></td>
<td>$row[1]</td><form action=edit.php method=post>
<td><input type=hidden value=$row[1] name=ID> </td>
<td><select name=action><option value=Delete>Delete<option value=Approve>Approve</select><input type=submit value=Submit name=submit></td></form>
</tr>";
}
echo '</table>';
} else {
echo "The query didnt find any results.";
}
if ($_POST['ID'] && $_POST['submit'] && $_POST['action']) {
$id2 = $_POST['ID'];
if ($_POST['action'] == Delete) {
$query2 = "DELETE FROM tutorials WHERE id='".$id2."' LIMIT 1";
$result2 = @mysql_query($query2);
} else {
$query3 = "UPDATE tutorials SET status='yes' WHERE id='".$id2."' LIMIT 1";
$result3 = @mysql_query($query3);
}
}
?>
</body>
</html>






