forked from cspeerly/Simple-ConnectDB
/
db_Info.php
71 lines (52 loc) · 1.45 KB
/
db_Info.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<title>Info w/MeekroDB</title>
<style type="text/css">
.details {
font-weight: bold;
text-decoration: underline;
}
.table {
border:solid 1px #336699;
}
</style>
<?php
require_once 'includes/MeekroDB/meekrodb.2.1.class.php';
DB::debugMode();
DB::$user = 'root';
DB::$password = 'muffin';
DB::$dbName = 'a1-sales';
$dbTable = 'customers';
DB::$port = '3307';
$mysqli_result = DB::queryRaw("SELECT * FROM " . $dbTable);
$row = $mysqli_result->fetch_assoc();
$field_cnt = count($row );
echo "FieldCount = " . $field_cnt . "<br>";
$columns = DB::columnList('customers');
echo "COPY THIS STRING FOR THE FIELD NAMES: ";
foreach ($columns as $column) {
echo "$column\n,";
}
echo "<br>";
/* Get field information for all columns */
$finfo = $mysqli_result->fetch_fields();
echo "1) length is the Max-length allowed in that field"."<br>";
echo "2) Max-length is the longest string in that field"."<br>";
echo "3) Type is the mySQLi Field Tyoe"."<br>";
echo "<table class='table'>";
echo "<tr class='details'>";
echo "<td>#</td><td>NAME</td><td>length</td><td>Max-length</td><td>Type</td>";
echo "</tr>";
$a=1;
foreach ($finfo as $val) {
echo "<tr>";
echo"<td>". $a . "</td>";
echo"<td>". $val->name . "</td>";
echo"<td>". $val->length . "</td>";
echo"<td>". $val->max_length . "</td>";
echo"<td>". $val->type . "</td>";
echo "</tr>";
$a++;
}
echo "</table>";
/* close connection */
$mysqli_result->close();
?>