4
What is wrong with this code? I am not getting any output (this is in the admin menu, and I left out the document info that is why there is no php tag)
include '../../../include/cp_header.php';
xoops_cp_header();
$table = $xoopsDB->prefix('qmagic');
//check to see if there is a quote to be deleted
if (isset($_POST['Delete']))
{
$dindex = $_POST['qindex'];
$query = "DELETE FROM $table WHERE index='$dindex'";
$xoopsDB -> query($query);
echo _MD_QM_DELETED;
}
//checks to see if a quote needs approved
if (isset($_POST['Approve']))
{
$uindex = $_POST['qindex'];
$query = "UPDATE $table SET $table.approved = '1' WHERE index='$uindex'";
echo _MD_QM_APPROVED;
}
//checks to see if a quote needs updated
if (isset($_POST['S1']))
{
$uindex = $_POST['qindex'];
$quote = $_POST['S1'];
$query = "UPDATE $table SET $table.quote = '$quote' WHERE index='$uindex'";
echo _MD_QM_UPDATED;
}
//gets all the quotes and lines them up with the user names of the submitters
$userdb = $xoopsDB->prefix('users');
$query = "SELECT $table.index, $table.quote, $table.approved, $userdb.uname, from $table, $userdb order by $table.index desc WHERE $table.user_id = $userdb.uid";
$result = $xoopsDB -> query($query);
//$R = mysql_num_rows($result);
$R = $xoopsDB -> getRowsNum($result);
$i = 0;
while ($i < $R) {
@$qaprove=mysql_result($result,$i,"approved");
@$qindex=mysql_result($result,$i,"index");
@$qcontent=mysql_result($result,$i,"quote");
@$quser_name=mysql_result($result,$i,"uname");
echo "<table border="1" width="552" height="1">"
."<tr>"
."<form method="POST" action="">"
."<td width="63" height="1"><input type="submit value="_MD_QM_DELETE" name=Delete"></td>"
."<input type="hidden" value="$qindex" name="$qindex">"
."</form>";
if ($qaprove = 0)
{
Echo "<form method="POST" action="">"
."<td width="64"><input type="submit" value="_MD_QM_APPROVE" name="Approve">"
."<input type="hidden" value="$qindex" name="$qindex">"
."</form>";
}
echo "<td width="160" height="1">"
."User: $quser_name"
."</td>"
."</tr>"
."</table>"
."<form method="POST" action="">"
."<p><textarea rows="5" name="S1" cols=50" value="$qcontent"></textarea></p>"
."<input type="hidden" value="$qindex" name="$qindex">"
."</form>";
++$i;
}
xoops_cp_footer();
?>