-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimportSQL.php
More file actions
34 lines (26 loc) · 726 Bytes
/
importSQL.php
File metadata and controls
34 lines (26 loc) · 726 Bytes
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
<?php
include("helper.php");
$errors = array();
$goToNextStep = false;
$host = $_SESSION['db_host'];
$username = $_SESSION['db_user'];
$password = $_SESSION['db_pass'];
$database = $_SESSION['db_name'];
// connect to database
$con = mysql_connect($host, $username, $password);
mysql_select_db($database, $con);
// read import sql
$import = file_get_contents("config/import.sql");
$queries = array();
PMA_splitSqlFile($queries, $import);
foreach ($queries as $query)
{
if (!mysql_query($query['query']))
{
$errors[] = "<b>".mysql_error()."</b><br>(".substr($query['query'], 0, 200)."...)";
}
}
// close connection
mysql_close($con);
// show error
include("templates/importSQL.php");