<?php
$db_host = 'localhost';
$db_port = '8080';
$db_name = 'dev';
$db_user = 'dev';
$db_pwd = 'dev';
$con = mysqli_connect($db_host.':'.$db_port, $db_user, $db_pwd);
$db = mysqli_select_db($con, $db_name);
print_r($db);
$file_name = 'filename';
//$file_name = 'test';
$file = fopen($file_name, 'r') or die('unable to open file!');
while(!feof($file)) {
$str = fgets($file);
$data[] = explode(" ", $str);
}
array_pop($data);
shuffle($data);
foreach($data as $val) {
$email = '';
$sql = "insert into table set
name='{$val[1]}',
password='{$val[0]}'
";
echo "\n";
print_r($sql);
mysqli_query($con, "set names utf8");
mysqli_query($con,$sql);
}
$db_host = 'localhost';
$db_port = '8080';
$db_name = 'dev';
$db_user = 'dev';
$db_pwd = 'dev';
$con = mysqli_connect($db_host.':'.$db_port, $db_user, $db_pwd);
$db = mysqli_select_db($con, $db_name);
print_r($db);
$file_name = 'filename';
//$file_name = 'test';
$file = fopen($file_name, 'r') or die('unable to open file!');
while(!feof($file)) {
$str = fgets($file);
$data[] = explode(" ", $str);
}
array_pop($data);
shuffle($data);
foreach($data as $val) {
$email = '';
$sql = "insert into table set
name='{$val[1]}',
password='{$val[0]}'
";
echo "\n";
print_r($sql);
mysqli_query($con, "set names utf8");
mysqli_query($con,$sql);
}
fclose($file);