File "transfert.php"
Full Path: /home/analogde/www/userlogin/Job/transfert.php
File size: 1.49 KB
MIME-type: text/x-php
Charset: utf-8
<?php
$file = "files_to_upload.txt";
$matches = $_POST['matches'];
//$nb = count($matches);
//if( $nb != 0)
//{
// if( file_exists($file);
// {
// unlink($file);
// }
$handle = fopen($file, "w") or die("Unable to open file!");
for ($i = 0; $i < count($matches); $i++)
{
fwrite($handle, $matches[$i] ."\n");
}
fclose($handle);
//$db_host="localhost";
//$db_user="root";
//$db_pass="";
//$db_name="internetbanking";
$db_host = "analogdepat.mysql.db";
$db_user = "analogdepat";
$db_pass = "Un92pac007";
$db_name = "analogdepat";
$connexion = new mysqli($db_host, $db_user, $db_pass, $db_name);
if ($connexion->connect_error)
{
die("Connection failed: " . $connexion->connect_error);
}
$cars = array("Peugeot", "Renault", "Fiat");
mysqli_query($connexion,'TRUNCATE TABLE aze');
print_r($cars);
for ($i = 0; $i < count($cars); $i++)
{
//INSERT INTO `aaa_upload_files` (`id`, `filename`) VALUES (NULL, 'gaz.pdf');
$val = $cars[$i];
//$sql = "INSERT INTO aze ('id', 'filename') VALUES ($val)";
$sql = "INSERT INTO aze (filename) VALUES ('$val')";
echo $sql ."<br>";
$connexion->query($sql);
}
/*
// sql to create table
"CREATE TABLE aaa_upload_files (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
filename VARCHAR(100) NOT NULL
)";
*/
/*
CREATE TABLE abc (
id int(11) NOT NULL AUTO_INCREMENT,
filename varchar(200) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
*/
?>