in-je-database-kijken-zonder-phpadmin-of-ander-pro
Gesponsorde koppelingen
PHP script bestanden
Code (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
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
<?php
//voeg je database gegevens hier toe
$sqlhost = "localhost";
$sqluser = "";
$sqlpass = "";
$sqldbase = "";
@mysql_connect($sqlhost,$sqluser,$sqlpass)or die("<br>Database unreachable or temporarly offline<BR>Sorry.");
@mysql_select_db($sqldbase);
if(!isset($_GET["table_name"])) {
$rTables = mysql_list_tables($sqldbase);
$iNumRows = mysql_num_rows($rTables);
for ($i = 0; $i < $iNumRows; $i++) {
echo "<font size=2 face=verdana>Table: <a href=?table_name=".mysql_tablename($rTables, $i).">".mysql_tablename($rTables, $i)."</a></font><br>";
}
} else {
$aFields = array();
$sTableName = $_GET["table_name"];
echo "<table border=1 bordercolor=black><tr>";
$bResult = mysql_query("SHOW COLUMNS FROM ".$sTableName) or die(mysql_error());
if (mysql_num_rows($bResult) > 0) {
while ($oRow = mysql_fetch_object($bResult)) {
echo "<td><font size=2 face=verdana>".$oRow->Field."</font></td>";
array_push($aFields, $oRow->Field);
}
}
$bResult = mysql_query("SELECT * FROM ".$sTableName);
while($oRow = mysql_fetch_object($bResult)) {
echo "<tr>";
foreach($aFields as $sField) {
echo "<td><font size=2 face=verdana>".$oRow->$sField."</font></td>";
}
}
echo "</table>";
}
?>
//voeg je database gegevens hier toe
$sqlhost = "localhost";
$sqluser = "";
$sqlpass = "";
$sqldbase = "";
@mysql_connect($sqlhost,$sqluser,$sqlpass)or die("<br>Database unreachable or temporarly offline<BR>Sorry.");
@mysql_select_db($sqldbase);
if(!isset($_GET["table_name"])) {
$rTables = mysql_list_tables($sqldbase);
$iNumRows = mysql_num_rows($rTables);
for ($i = 0; $i < $iNumRows; $i++) {
echo "<font size=2 face=verdana>Table: <a href=?table_name=".mysql_tablename($rTables, $i).">".mysql_tablename($rTables, $i)."</a></font><br>";
}
} else {
$aFields = array();
$sTableName = $_GET["table_name"];
echo "<table border=1 bordercolor=black><tr>";
$bResult = mysql_query("SHOW COLUMNS FROM ".$sTableName) or die(mysql_error());
if (mysql_num_rows($bResult) > 0) {
while ($oRow = mysql_fetch_object($bResult)) {
echo "<td><font size=2 face=verdana>".$oRow->Field."</font></td>";
array_push($aFields, $oRow->Field);
}
}
$bResult = mysql_query("SELECT * FROM ".$sTableName);
while($oRow = mysql_fetch_object($bResult)) {
echo "<tr>";
foreach($aFields as $sField) {
echo "<td><font size=2 face=verdana>".$oRow->$sField."</font></td>";
}
}
echo "</table>";
}
?>