最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php實(shí)現(xiàn)的MySQL通用查詢程序

 更新時(shí)間:2007年03月11日 00:00:00   作者:  
if(get_magic_quotes_gpc()==1){
   ?>
<html>
<head><title>MySQL通用查詢程序</title></head>
<body>
注意本程序需要將PHP配置文件(PHP3為php3.ini,PHP4為php.ini)中的magic_quotes_gpc
設(shè)成Off或0,修改后請(qǐng)重新啟動(dòng)Apache.
</body>
</html>
   <?
   exit();
}
set_magic_quotes_runtime(0);
$host = 'localhost';
$db = 'test';
$user = 'test';
$pass = '';
// [ php/inc/str2url.php ] cvs 1.2
function str2url($path){
   return eregi_replace("%2f","/",urlencode($path));
}
?>
<html>
<head><title>MySQL通用查詢程序</title></head>
<body>
<form action="<?echo str2url($PHP_SELF);?>" method="post">
請(qǐng)輸入SQL語(yǔ)句:<br>
<textarea name="sql" cols="100" rows="5"><?echo $sql;?></textarea><br>
<input type="submit" name="cmd" value="查詢">
<input type="submit" name="cmd" value="執(zhí)行">
</form>
<?
if($cmd){
   $con = mysql_pconnect($host,$user,$pass) or die('無(wú)法連接'.$host.'服務(wù)器');
   mysql_select_db($db,$con) or die('無(wú)法連接'.$db.'數(shù)據(jù)庫(kù)');
   $rst = mysql_query($sql,$con) or die($sql.'出錯(cuò)');
   if($cmd=='查詢'){
      $num_fields = mysql_num_fields($rst);
      echo '<hr>';
      echo '<table border="1" cellpadding="0" cellspacing="0">';
      echo '<caption align="center">'.$sql.'</option>';
      echo '<tr>';
      for($i=0;$i<$num_fields;$i++) echo '<th>&nbsp;'.mysql_field_name($rst,$i).'</th>';
      echo '</tr>';
      while($row=mysql_fetch_row($rst)){
         echo '<tr>';
         for($i=0;$i<$num_fields;$i++) echo '<td>&nbsp;'.$row[$i].'</td>';
         echo '</tr>';
      }
      echo '</table>';
      mysql_free_result($rst);
   }
   else echo '有 '.mysql_affected_rows($con).' 行受影響';
}
?>
</body>
</html>

相關(guān)文章

最新評(píng)論

巩义市| 安新县| 资中县| 兴安县| 安庆市| 宕昌县| 大厂| 垦利县| 肇东市| 比如县| 承德县| 花垣县| 大竹县| 乐亭县| 菏泽市| 高平市| 穆棱市| 南溪县| 调兵山市| 湖州市| 彰化市| 迁安市| 甘德县| 房产| 花莲县| 称多县| 平顶山市| 浠水县| 化州市| 扶沟县| 汝南县| 慈利县| 贡嘎县| 綦江县| 郑州市| 东辽县| 兰坪| 波密县| 大竹县| 高平市| 余姚市|