Location: PHPKode > projects > PHP Simple FAQ > phpsimplefaq1.1beta/phpsimplefaq/includes/admin_answer.inc.php
<?

// PHP Simple FAQ Question admin page v1.0

if ($remove) 

	{
		$remove_sql = "DELETE FROM $database_name.$answer_table 
					   WHERE answer_id='$remove'";
		mysql_query($remove_sql,$connection);
	}

$sql = "SELECT * 
		FROM $database_name.$category_table
		ORDER by faq_id, category";
$result = mysql_query($sql,$connection);
									
?>
<br>
<center>				
<table border="0" width="100%" cellspacing="2" cellpadding="2">
	<tr>
		<td colspan="2"><center><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\"><B>$manage_answers_lang</b><br>"; ?>
		<?  if ($remove) echo "<font color=\"red\">$ans_deleted_lang</font>"; ?></font></center></td>
	</tr>
</table>
<form action="manage_faq.php?action=answers" method="post">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td align="center"><select name="cat_is" size="1" class="form_style">
		  <? while ($row2 = mysql_fetch_array($result)) {
			$category = $row2['category'];
			$cat_id = $row2['cat_id'];
			$faq_id = $row2['faq_id'];
			$faq_is = "SELECT faq_title
					   FROM $database_name.$faq_table
					   WHERE faq_id = '$faq_id'";
			$result3 = mysql_query($faq_is, $connection);
			$row3 = mysql_fetch_array($result3);
			$faq_title = $row3['faq_title'];
			echo "$faq_is";
			if ($cat_id == $cat_is) 
			
				{
					echo "<option value=\"$cat_id\" selected>$faq_title -- $category</option>";
				} else {
					echo "<option value=\"$cat_id\">$faq_title -- $category</option>";
				}
			}
			?>
		  </select>&nbsp;
		 	<?
		  		echo "<input type=\"hidden\" name=\"email\" value=\"$email\">";
			    echo "<input type=\"hidden\" name=\"password\" value=\"$password\">";
		 	?>
		 <input type="submit" name="Submit" value="<? echo "$submit_button_lang"; ?>"></button></td>
	</tr>
</table>
</form>

<?
if ($cat_is) 
	
	{

?>

<table width="90%" cellpadding="4" cellspacing="2" bgcolor="#333366"> 
	<tr>
		<td align="LEFT" bgcolor="#3366CC"><b><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\" color=\"#FFFFFF\">$question_category_lang</FONT></B></TD>"; ?>
		<td align="CENTER" bgcolor="#3366CC" width="100"><b><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\" color=\"#FFFFFF\">$delete_lang</FONT></B></TD>"; ?>
	</tr>
<?
$get = "SELECT * 
		FROM $database_name.$question_table 
		WHERE cat_id='$cat_is'
		ORDER BY question";
$result = mysql_query($get, $connection);
if (mysql_numrows($result) == 0) 
	
		{
			echo "<tr>\n";
			echo "<td align=\"LEFT\" bgcolor=\"#CCCCCC\" colspan=\"2\"><font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$no_questions_lang.</font></td>\n";
			echo "</tr>\n";
		}
		
while ($myrow = mysql_fetch_array($result)) 

	{
		$question = $myrow["question"];
		$q_id = $myrow["question_id"];
		echo "<tr>\n";
		echo "<td align=\"LEFT\" bgcolor=\"#3366CC\" colspan=\"2\"><font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\" color=\"#ffffff\"><a class=\"psf\" href=\"index.php?action=answers&category=$cat_id&q_id=$q_id\" style=\"color: #FFFFFF\"><b>$question</a></b></font></td>\n";
		echo "</tr>\n";
		$q_get = "SELECT *
				  FROM $database_name.$answer_table 
				  WHERE q_id='$q_id'";
		$q = mysql_query($q_get, $connection);
		$q_num = mysql_numrows($q);
		if ($q_num == 0) 
		
			{
				echo "<tr>\n";
				echo "<td align=\"LEFT\" bgcolor=\"#CCCCCC\" colspan=\"2\"><font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$noans_lang</font></td>\n";
				echo "</tr>\n";
			}
		
		while ($myrow4 = mysql_fetch_array($q)) 
		   
		   {
			   $answer = $myrow4["answer"];
			   $answer_id = $myrow4["answer_id"];
			   
			   echo "<tr>\n";
			   echo "<td align=\"LEFT\" bgcolor=\"#CCCCCC\"><font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$answer</font></td>\n";
			   echo "<td align=\"CENTER\" valign=\"TOP\" bgcolor=\"#CCCCCC\" width=\"100\"><form method=\"post\" action=\"manage_faq.php?action=answers&remove=$answer_id\">";
			   echo "<INPUT TYPE=\"hidden\" NAME=\"email\" VALUE=\"$email\">";
			   echo "<INPUT TYPE=\"hidden\" NAME=\"password\" VALUE=\"$password\">";
			   echo "<INPUT TYPE=\"hidden\" NAME=\"admin\" VALUE=\"yes\">";
			   echo "<INPUT TYPE=\"hidden\" NAME=\"cat_is\" VALUE=\"$cat_is\">";
			   echo "<INPUT TYPE=\"submit\" NAME=\"Submit\" VALUE=\"$delete_lang\">";
			   echo "</FORM>";
			   echo "</td>";
			   echo "</tr>\n";
			  
			}
	}
 
 ?>
</table>

<? } ?>

</center>

				
				
				
Return current item: PHP Simple FAQ