-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_tables.php
46 lines (40 loc) · 1.27 KB
/
get_tables.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
<?php
require_once 'config.php';
if (isset($_GET['database'])) {
$db = $_GET['database'];
}
else{
echo "No Database name found!";
exit();
}
$link = mysql_connect($config['database']['server'], $config['database']['username'], $config['database']['password']);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
// make current db
$db_selected = mysql_select_db($db, $link);
if (!$db_selected) {
die ('Can\'t use '.$db.' : ' . mysql_error());
}
?>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<select class="form-control" id="ddl_table">
<option disabled selected>Select table</option>
<?php
// Usage without mysql_list_dbs()
$res = mysql_query("SHOW TABLES;");
while ($row = mysql_fetch_assoc($res)) {
echo '<option>'. $row['Tables_in_'.$db] .'</option>';
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<input type="text" id="txt_name" class="form-control" placeholder="Enter name">
</div>
</div>
</div>