Location: PHPKode > projects > PHP Simple FAQ > phpsimplefaq1.1beta/phpsimplefaq/includes/admin_faq.inc.php
<?  // PHP Simple FAQ FAQ admin page v1.0

if (($add) && ($faq_title)) 

	{
		$new_sql = "INSERT INTO $database_name.$faq_table (faq_title, faq_creator)
					VALUES ('$faq_title', '$new_faq_creator')";
		mysql_query($new_sql,$connection);
	}

if ($remove) 

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

$sql = "SELECT * 
		FROM $database_name.$faq_table";
$result = mysql_query($sql,$connection);

if (!$user_id) {
	$sql3 = "SELECT * 
			 FROM $database_name.$user_table
			 WHERE user_email='$php_simplefaq_email'";
	$result3 = mysql_query($sql3,$connection);
	$myrow3 = mysql_fetch_array($result3);
	$user_id = $myrow3["user_id"];
}					
?>
				
<br>
<center>
<table border="0" width="100%" cellspacing="2" cellpadding="2" bgcolor="#FFFFFF">
	<tr>
		<td colspan="2"><center><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\"><b>$manage_thefaqs_lang</b><br>"; ?>
		<? if (($add) && ($faq_title)) echo "<font color=\"red\">$faq_created_lang.</font><br>";
		   if (($add) && (!$faq_title)) echo "<font color=\"red\">$faq_empty_lang.</font><br>";
		   if ($remove) echo "<font color=\"red\">$faq_deleted_lang.</font><br>"; ?></font></center></td>
	</tr>
</table>
<br>
<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\">$faq_title_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\">$creator_addfaq_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>
	<?	
		while ($myrow = mysql_fetch_array($result)) 
		
			{
				$faq_id = $myrow["faq_id"];
				$faq_title = $myrow["faq_title"];
				$faq_creator = $myrow["faq_creator"];
				$sql2 = "SELECT user_name
						 FROM $database_name.$user_table
						 WHERE $user_table.user_id='$faq_creator'";
				$result2 = mysql_query($sql2,$connection);
				$myrow2 = mysql_fetch_array($result2);
				$creator_nick = $myrow2["user_name"];
	?>
	<tr>
		<td align="LEFT" valign="TOP" bgcolor="#CCCCCC"><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$faq_title"; ?></font></td>
		<td align="LEFT" valign="TOP" bgcolor="#CCCCCC" width="100"><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\">$creator_nick"; ?></font></td>
		<td align="CENTER" valign="TOP" bgcolor="#CCCCCC" width="100">
		<?     
			   echo "<form method=\"post\" action=\"manage_faq.php?action=faq&remove=$faq_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=\"submit\" name=\"Submit\" value=\"$delete_lang\">";
			   echo "</form>"; ?></td>
	</tr>
		<? } ?>
	<tr>
		<td valign="TOP" align="LEFT" bgcolor="#3366CC"><form name="form2" method="post" action="manage_faq.php?action=faq&add=yes"><? echo "<font face=\"$font_face\" size=\"$font_size\" class=\"$font_class\" color=\"#FFFFFF\"><b>$addnew_faq_lang:</b></font></td>"; ?>
		<td valign="TOP" align="LEFT" bgcolor="#CCCCCC" width="100"><input type="text" name="faq_title"></td>
		<td valign="TOP" align="CENTER" bgcolor="#CCCCCC" width="100">
		<?
		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=\"new_faq_creator\" value=\"$user_id\">";
		?>
		<input type="submit" name="submit" value="<? echo "$addnew_faq_but_lang"; ?>"></td>
	</tr>
</table>

</center>
Return current item: PHP Simple FAQ