Location: PHPKode > scripts > MySql database query tool > HDBQ_2_1/add.php
<?php
include "authheader.php";
if($block == false){
?>

<html>
<head>

<?php
include "header.php";
?>

<tr bgcolor=#ffffff height=100%>
<td width=100% align=center valign=top>

<br>
<table cellpadding=2 cellspacing=1 align=center style="background-color: #efffee; 
font-size: 13px; font-family: arial, verdana, san-serif;" border=0>
<?php
	include "queries.php";

	$add = $_POST['add'];
	$namea = $_POST['namea'];
	$querya = $_POST['querya'];

	$querya = str_replace("\\","",$querya);
	$querya = htmlspecialchars($querya,ENT_QUOTES);
	$namea = str_replace("\\","",$namea);
	$namea = htmlspecialchars($namea,ENT_QUOTES);

	if($add == "add")
	{
		$coount = count($query);

		if($querya != "" && $namea != ""){
			$coounta = $coount+1;
			$query[$coount] = $querya;
			$name[$coount] = $namea;

			$open = fopen("queries.php","w");
			fwrite($open,"<?php \n\n");
		
			for($dfd=0; $dfd < $coounta; $dfd++){
			fwrite($open,"$"."name[$dfd] = \"$name[$dfd]\"; \n");
			fwrite($open,"$"."query[$dfd] = \"$query[$dfd]\"; \n");
			}
			fwrite($open,"\n?>");
		
			echo "<div align=center><font color=green>Added the new query</font></div>";
			echo "<br><br><div align=center>Added another</div>";
		}else{
			echo "<div align=center><font color=red>Blank spaces are not accepted</font></div>";
		}
	}


	echo "<tr bgcolor=$col><td align=center><br>
	<form name=xxx method=post style=\"margin: 0px; padding: 0px;\">	<input type=hidden name=add value=add></input>";
	echo "Display Name: <input name=namea></input><br>";
	echo "Query <textarea name=querya cols=44 rows=4></textarea><br><br>";		
	echo "</td><td>
	<input type=submit value=ADD>
	</form><br><br></td></tr>
	<tr><td width=300 style=\"padding-left: 20px;\">
	When adding date based queries add XXDATE in the place of date.
	 In the query page, you can easily select the date using the calendar.<br><br>
	e.g: Query - select * from xxx where date like 'XXDATE'
	</td></tr>";
?>
</table>

<?php
include "footer.php";
}
?>
Return current item: MySql database query tool