Home > Backend Development > PHP Tutorial > dwgsee plus picture browser, a simple MySQL data browser

dwgsee plus picture browser, a simple MySQL data browser

WBOY
Release: 2016-07-29 08:33:55
Original
1539 people have browsed it

This program can be used to browse data in MySQL. You can make a very good MySQL browser with a few modifications.
*/
/*
?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('Unable to 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                                                                                              . $i=0;$i<$num_rows;$i++){
                                                                                                                                             
             urlencode($db).'">'.$db.'
'.chr(13);                                                                      case 'table' :
             $tables = @mysql_list_tables($db,$con) or die('mysql_list_tables                                                                                                  $tables =                                                                                                       $tables =      ;'.chr(13);
$num_rows = mysql_num_rows($tables);
for($i=0;$i<$num_rows;$i++){
$table = mysql_tablename($tables,$i);
echo '                                                                         ;/a>
'.
chr(13);
}
mysql_free_result($tables);
echo '


Break;
case' record ':
$ records = mysql_db_query ($ db,' select * from '. M DIE ('MySQL_DB_QURY 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++)
                                                                                                                         not not less – echo ''.chr(13); 
                Echo '& lt;/table & gt;'. Chr (13);
mysql_free_result ($ records);
echo '& lt; & lt; & lt; a href = "'. "& gt; show databases & lt ;/a>
                                                                                                                                                       break;
}
mysql_close($con) or die('Unable to disconnect from '.$host.');
?>

The above introduces the dwgsee plus picture browser, a simple MySQL data browser, including the content of the dwgsee plus picture browser. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
" .$row[$i].''.chr(13);
            echo '