Home php教程 php手册 一个简单的php实现的MySQL数据浏览器

一个简单的php实现的MySQL数据浏览器

Jun 13, 2016 pm 12:32 PM
mysql php Can accomplish you data Browse Browser of program Simple this

这个程序可以用来浏览MySQL中的数据,您可以稍做修改就可以做出很不错的MySQL浏览器.
*/
/*
?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('无法连接'.$host);
switch($cmd){
   case 'db':
      $dbs = mysql_list_dbs($con) or die('mysql_list_dbs 出错:'.$php_errmsg);
      echo 'databases on '.$host.':
'.chr(13);
      $num_rows = mysql_num_rows($dbs);
      for($i=0;$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 出错:'.
                $php_errmsg);
      echo 'tables on '.$db.' of '.$host.':
'.chr(13);
      $num_rows = mysql_num_rows($tables);
      for($i=0;$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 出错:'.$php_errmsg);
      echo 'records on '.$table.':
'.chr(13);
      echo ''.chr(13);
      echo ''.chr(13);
      $num_fields = mysql_num_fields($records);
      for($i=0;$i         echo ''.chr(13);
      echo ''.chr(13);
      while($row=mysql_fetch_row($records)){
         echo ''.chr(13);
         for($i=0;$i            echo ''.chr(13);
         echo ''.chr(13);
      }
      echo '
 '.mysql_field_name($records,$i).'
 '.$row[$i].'
'.chr(13);
      mysql_free_result($records);
      echo '
show databases  
           show tables
           
'.chr(13);
      break;
}
mysql_close($con) or die('无法与'.$host.'断开连接');
?>
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

The Compatibility of IIS and PHP: A Deep Dive The Compatibility of IIS and PHP: A Deep Dive Apr 22, 2025 am 12:01 AM

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

What to do if the USDT transfer address is incorrect? Guide for beginners What to do if the USDT transfer address is incorrect? Guide for beginners Apr 21, 2025 pm 12:12 PM

After the USDT transfer address is incorrect, first confirm that the transfer has occurred, and then take measures according to the error type. 1. Confirm the transfer: view the transaction history, obtain and query the transaction hash value on the blockchain browser. 2. Take measures: If the address does not exist, wait for the funds to be returned or contact customer service; if it is an invalid address, contact customer service and seek professional help; if it is transferred to someone else, try to contact the payee or seek legal help.

How does MySQL differ from Oracle? How does MySQL differ from Oracle? Apr 22, 2025 pm 05:57 PM

MySQL is suitable for rapid development and small and medium-sized applications, while Oracle is suitable for large enterprises and high availability needs. 1) MySQL is open source and easy to use, suitable for web applications and small and medium-sized enterprises. 2) Oracle is powerful and suitable for large enterprises and government agencies. 3) MySQL supports a variety of storage engines, and Oracle provides rich enterprise-level functions.

Web3 trading platform ranking_Web3 global exchanges top ten summary Web3 trading platform ranking_Web3 global exchanges top ten summary Apr 21, 2025 am 10:45 AM

Binance is the overlord of the global digital asset trading ecosystem, and its characteristics include: 1. The average daily trading volume exceeds $150 billion, supports 500 trading pairs, covering 98% of mainstream currencies; 2. The innovation matrix covers the derivatives market, Web3 layout and education system; 3. The technical advantages are millisecond matching engines, with peak processing volumes of 1.4 million transactions per second; 4. Compliance progress holds 15-country licenses and establishes compliant entities in Europe and the United States.

Can two exchanges convert coins to each other? Can two exchanges convert coins to each other? Can two exchanges convert coins to each other? Can two exchanges convert coins to each other? Apr 22, 2025 am 08:57 AM

Can. The two exchanges can transfer coins to each other as long as they support the same currency and network. The steps include: 1. Obtain the collection address, 2. Initiate a withdrawal request, 3. Wait for confirmation. Notes: 1. Select the correct transfer network, 2. Check the address carefully, 3. Understand the handling fee, 4. Pay attention to the account time, 5. Confirm that the exchange supports this currency, 6. Pay attention to the minimum withdrawal amount.

Tips and recommendations for the top ten market websites in the currency circle 2025 Tips and recommendations for the top ten market websites in the currency circle 2025 Apr 22, 2025 am 08:03 AM

Domestic user adaptation solutions include compliance channels and localization tools. 1. Compliance channels: Franchise currency exchange through OTC platforms such as Circle Trade, domestically, they need to go through Hong Kong or overseas platforms. 2. Localization tools: Use the currency circle network to obtain Chinese information, and Huobi Global Station provides a meta-universe trading terminal.

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

See all articles