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

// PHP Simple FAQ Question admin page v1.0

if ($remove) 

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

$sql = "SELECT * 
		FROM $database_name.$faq_table
		ORDER by faq_id";
$result = mysql_query($sql,$connection);
$sql5 = "SELECT * 
		 FROM $database_name.$user_table
		 WHERE user_email='$email'";
$result5 = mysql_query($sql5,$connection);
$myrow5 = mysql_fetch_array($result5);
$creator = $myrow5["user_id"];	
									
?>
<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_questions_lang</b><br>"; ?>
		<?  if ($remove) echo "<font color=\"red\">$quesiton_deleted_lang.</font></font></center></td>"; ?>
	</tr>
</table>
<form action="manage_faq.php?action=questions" method="post">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td align="center"><select name="faq_is" size="1" class="form_style">
		  <? while ($row2 = mysql_fetch_array($result)) {
			$faq_title = $row2['faq_title'];
			$faq_id = $row2['faq_id'];
			if ($faq_id == $faq_is) 
			
				{
					echo "<option value=\"$faq_id\" selected>$faq_title</option>";
				} else {
					echo "<option value=\"$faq_id\">$faq_title</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 ($faq_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.$category_table 
		WHERE faq_id='$faq_is'
		ORDER BY category";
$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\"><a class=\"psf\" href=\"admin.php\">$add_category2_lang.</a></font></td>\n";
			echo "</tr>\n";
		}
		
while ($myrow = mysql_fetch_array($result)) 

	{
		$cat = $myrow["category"];
		$cat_id = $myrow["cat_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=qa&category=$cat_id\" style=\"color: #FFFFFF\"><b>$cat</a></b></font></td>\n";
		echo "</tr>\n";
		$q_get = "SELECT *
				  FROM $database_name.$question_table 
				  WHERE cat_id='$cat_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\">$no_questions_lang.</font></td>\n";
				echo "</tr>\n";
			}
		
		while ($myrow4 = mysql_fetch_array($q)) 
		   
		   {
			   $question = $myrow4["question"];
			   $question_id = $myrow4["question_id"];
			   $get_a = "SELECT * 
						 FROM $database_name.$answer_table 
						 WHERE q_id='$question_id'";
			   $result_a = mysql_query($get_a, $connection);
			   $a_total = mysql_numrows($result_a);	 
			   
			   if ($a_total == 1) 
			   
				   {	 
					   $a_num = "$a_total $answer_lang";
				   } else {
					   $a_num = "$a_total $answers_lang";
				   }
			   
			   echo "<tr>\n";
			   echo "<td align=\"LEFT\" bgcolor=\"#CCCCCC\"><font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$question - <I>$a_num</I></font></td>\n";
			   echo "<td align=\"CENTER\" valign=\"TOP\" bgcolor=\"#CCCCCC\" width=\"100\"><form method=\"post\" action=\"manage_faq.php?action=questions&remove=$question_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=\"faq_is\" VALUE=\"$faq_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