<?
/*
PHP Code Builder
Copyright (C) 2007 Revmakx
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ include('manage_header.php'); ?>
<?
$create_db=1;
$q1e=mysql_query('show databases');
if(!$q1e)
echo 'error q1'.mysql_error();
$n1=mysql_num_rows($q1e);
if($n1==0)
echo '<option>No Database is saved </option>';
else
{
for($i=0;$i<$n1;$i++)
{
$a1=mysql_fetch_array($q1e);
if($a1[0]=='phpcb10')
$create_db=0;
}
}
?>
<? if($create_db==1)
{ ?>
<form name="form_cdb" method="post" action=""><table width="320" border="0" align="center">
<tr>
<td width="304" align="center">Create a Data base to store Functions </td>
</tr>
<tr>
<td align="center" valign="top">
<input name="btn" type="submit" id="btn" value="Create New Data Base"> </td>
</tr>
</table>
</form>
<? }//create_db
else echo'<h3><center>*Database is already exist</center></h3>';?>
<p> </p>
<? if($btn=='Create New Data Base')
{
include('connect.php');
$q1e=mysql_query("create database phpcb10");
if(!$q1e) { echo 'Error'.mysql_error().'<br>'; }
else
{
$db='phpcb10';
include('connect.php');
$q2e=mysql_query("CREATE TABLE `pcb_fun10` (`sno` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,`fun_name` VARCHAR( 30 ) NOT NULL ,`fun_text` LONGTEXT NOT NULL)");
if(!$q2e) echo 'Error in creating table'.mysql_error().'<br>';
else
{
echo '<center>Database phpcb10 is created.<br>Table pcb_fun10 is created.</center>';
}
}
}
?>
<? require("footer.php");?>