-Automatic setup is started...
');
global $host,$username,$password,$link;
//$link=mysql_connect($host, $username, $password);
$sql= 'CREATE DATABASE info';
if (!mysql_query ($sql, $link)) die('
Failed to
create database!
>>Please check the parameters and database server<<
');
$sql = "CREATE TABLE `info`.`info1` (
`ID` INT NOT NULL ,
`information` TEXT NOT NULL
) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;";
mysql_query($sql) or die('Setup Failed');
echo('
-Automatic setup completed successfully. Your Database is ready!
');
}
$link=mysql_connect($host, $username, $password);
if(!$link) die('
Failed to connect to the database!
>>Please check the parameters and database server<<
');
$db_name="info";
$result=mysql_select_db($db_name);
if(!$result){
setup();
}
if (isset($_GET['type'])){
$sql="SELECT * FROM info1";
$result=mysql_query($sql)or die(mysql_error());
$count=mysql_num_rows($result);
for($cn=1;$cn<=$count;$cn++){
$info=$_POST["txtI$cn"];
$sql2 = "UPDATE `info`.`info1` SET `information` = '$info' WHERE `info1`.`ID` = $cn LIMIT 1;";
$result2=mysql_query($sql2) or die(mysql_error());
}
$j=1;
while (isset($_POST["info$j"]) && $_POST["info$j"]!=""){
$id=$count+$j;
$info=$_POST["info$j"];
$sql3="INSERT INTO info1(ID,information)VALUES('$id', '$info')";
$result3=mysql_query($sql3);
if (!$result) die (mysql_error());
$j++;
}
}
?>