This app can be used to browse the data in MySQL, you can make a good MySQL browser with a little modification.
*/
/*
? cmd=db
? cmd=table&db={}
? cmd=record&db={}&table={}
*/
$host = ' localhost ';
$user = ' Test ';
$password = ";
if (!isset ($cmd)) $cmd = ' db ';
Switch ($cmd) {
Case ' db ':
Break
Case ' table ':
Break
Case ' record ':
Break
Default
$cmd = ' db ';
Break
}
$con = @mysql_connect ($host, $user, $password) or Die (' Cannot connect '. $host);
Switch ($cmd) {
Case ' db ':
$dbs = Mysql_list_dbs ($con) or Die (' Mysql_list_dbs error: '. $php _errmsg);
echo ' databases on '. $host. ':
'. chr (13);
$num _rows = mysql_num_rows ($dbs);
for ($i =0; $i < $num _rows; $i + +) {
$db = Mysql_tablename ($dbs, $i);
Echo ' UrlEncode ($db). ' " > '. $db. '
'. chr (13);
}
Mysql_free_result ($dbs);
Break
Case ' table ':
$tables = @mysql_list_tables ($db, $con) or Die (' Mysql_list_tables error: '.
$php _errmsg);
echo ' tables on '. $db. ' of '. $host. ':
'. chr (13);
$num _rows = mysql_num_rows ($tables);
for ($i =0; $i < $num _rows; $i + +) {
$table = Mysql_tablename ($tables, $i);
Echo ' UrlEncode ($db). ' &table= '. UrlEncode ($table). ' " > '. $table. '
'.
Chr (13);
}
Mysql_free_result ($tables);
echo ' show databases '. CHR (13);
Break
Case ' record ':
$records = Mysql_db_query ($db, ' select * from '. $table, $con) or
Die (' Mysql_db_query error: '. $php _errmsg);
Echo ' Records on '. $table. ':
'. chr (13);
Echo '
'. chr (13); Echo '
'. chr (13); $num _fields = Mysql_num_fields ($records); for ($i =0; $i < $num _fields; $i + +) echo '
. Mysql_field_name ($records, $i). | Chr (13); Echo '
'. chr (13); while ($row =mysql_fetch_row ($records)) {echo '
'. chr (13); for ($i =0; $i < $num _fields; $i + +) echo '
'. $row [$i]. ' | '. chr (13); Echo '
'. chr (13); } Echo '
'. chr (13);
Mysql_free_result ($records);
echo ' Show databases
Show tables
'. chr (13);
Break
}
Mysql_close ($con) or Die (' unable to $host. ' Disconnect ');
?>
The above describes the DWGSee plus view browser a simple MySQL data browser, including the DWGSee plus view browser content, want to be interested in PHP tutorial friends helpful.