[Solved] How to insert values into a mysql database using php


    /*
 * SQL
 CREATE TABLE `NewTable` (
`id`  int NOT NULL AUTO_INCREMENT ,
`col1`  varchar(255) NOT NULL ,
`col2`  varchar(255) NOT NULL ,
`col3`  varchar(255) NOT NULL ,
PRIMARY KEY (`id`)
)
;


 * 
 * /SQL
 */

 $mysqli = new mysqli("localhost", "DB_USERNAME", "DB_PASSWORD", "DB_NAME");
    if($mysqli->connect_error)
    {
      die('Connect Error' . $mysqli->connect_error);
    } 
$mysqli->query("SET NAMES 'utf8'");
$mysqli->query("SET CHARACTER SET 'utf8'");
$mysqli->query("SET COLLATION_CONNECTION='utf8_general_ci'");
$mysqli->query("SET character_set_results="utf8"");
$mysqli->query("SET character_set_server="utf8"");
$mysqli->query("SET character_set_client="utf8"");
//connection  END
if(isset($_POST['database']) and isset($_POST['evalue']) and isset($_POST['BlastSearch'])){
     $db = htmlspecialchars(strip_tags($_POST['database']));
    $evalue = htmlspecialchars(strip_tags($_POST['evalue']));
    $sequence = htmlspecialchars(strip_tags($_POST['BlastSearch']));
$mysqli->query("INSERT INTO TABLE_NAME (col1,col2,col3) VALUES('$db','$evalue','$sequence')");
}

3

solved How to insert values into a mysql database using php