辅导日
Posted panbee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了辅导日相关的知识,希望对你有一定的参考价值。
今天看了mysql,看完后又懵逼了...完全不会,而且新东西好多,晚上写代码都感觉稍微明白了一点...
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php $link = mysql_connect(\'localhost\', \'root\', \'admin\'); mysql_query(\'set names utf8\'); $databases = mysql_query(\'show databases\'); if(!$databases){ echo "执行失败,请参考:".mysql_error(); } else{ echo "执行成功!数据如下:"; while($res = mysql_fetch_array($databases)){ echo "<br>".$res[0]; echo " <a href=\'mysql_tables.php?db={$res[0]}\'>查看表</a>"; } } ?> </body> </html>
<?php $db = $_GET[\'db\']; $link = mysql_connect(\'localhost\',\'root\',\'admin\'); mysql_query(\'set names utf8\'); mysql_query("use $db"); $table = mysql_query(\'show tables\'); if(!$table){ echo "执行失败,请参考:".mysql_error(); } else{ echo "执行成功!数据如下:"; while($res=mysql_fetch_array($table)){ echo \'<br>\'.$res[0]; echo " <a href = mysql_table_struct.php?db=$db&table={$res[0]}>查看结构</a>"; echo " <a href = mysql_table_data.php?db=$db&table={$res[0]}>查看数据</a>"; } } ?>
<?php $db = $_GET[\'db\']; $table = $_GET["table"]; $link = mysql_connect(\'localhost\',\'root\',\'admin\'); mysql_query(\'set names utf8\'); mysql_query("use $db"); $struct = mysql_query("desc $table"); if(!$struct){ echo "执行失败,请参考:".mysql_error(); } else{ echo "执行成功!数据如下:"; echo "<table border=\'1\'>"; $field_count = mysql_num_fields($struct); echo "<tr>"; for($i=0; $i<$field_count; ++$i){ $file_name = mysql_field_name($struct,$i); echo "<td>".$file_name."</td>"; } echo "</tr>"; while($res = mysql_fetch_array($struct)){ echo "<tr>"; for($i=0; $i<$field_count; ++$i){ echo "<td>".$res[$i]."</td>"; } echo "</tr>"; } echo "</table>"; } ?>
<?php $db = $_GET[\'db\']; $table = $_GET["table"]; $link = mysql_connect("localhost","root","admin"); mysql_query("set names utf8"); mysql_query("use $db"); $data = mysql_query("select * from $table"); if(!$data){ echo "执行失败,请参考:".mysql_error(); } else{ echo "执行成功!数据如下:"; echo "<table border=\'1\'>"; $field_count = mysql_num_fields($data); echo "<tr>"; for($i=0; $i<$field_count; ++$i){ $field_name = mysql_field_name($data,$i); echo "<td>".$field_name."</td>"; } echo "</tr>"; while($res = mysql_fetch_array($data)){ echo "<tr>"; for($i=0; $i<$field_count; ++$i){ echo "<td>".$res[$i]."</td>"; } echo "</tr>"; } echo "</table>"; } ?>
以上是关于辅导日的主要内容,如果未能解决你的问题,请参考以下文章