-
Notifications
You must be signed in to change notification settings - Fork 1
/
using_helpers_with_connection_params.php
54 lines (42 loc) · 1.15 KB
/
using_helpers_with_connection_params.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require "../vendor/autoload.php";
$host = "localhost";
$user = "root";
$pass = "";
$name = "empty";
// Connection Parameters
// value key pair array
$connection_params = [
'host' => $host,
'name' => $name,
'user' => $user,
'pass' => $pass
];
if( isset($_POST) && isset($_FILES['db_file']) ){
$sql_content = $_FILES['db_file']['tmp_name'];
if( MysqlImporter(null, $sql_content, $connection_params) ){
echo "import";
};
}
elseif ( array_key_exists('export', $_GET) ) {
MysqlExporter(null, ['products'], false, $connection_params);
}
?>
<!DOCTYPE html>
<html>
<head>
<title> Mysql Export and Import Database and Table </title>
</head>
<body>
<h1> Mysql Export and Import Database and Table </h1>
<h2> Using Helpers with Connection Parameters </h2>
<pre> [ 'host' => host_name, 'name' => database_name, 'user' => user_name, 'pass' => password ] </pre>
<form enctype="multipart/form-data" method="POST">
<input type="file" name="db_file" />
<button type="submit" name="import">Go</button>
</form>
<form method="GET" >
<button name="export"> Export </button>
</form>
</body>
</html>