Home > php教程 > php手册 > MySQL通用查询程序

MySQL通用查询程序

WBOY
Release: 2016-06-13 10:31:07
Original
1248 people have browsed it

if(get_magic_quotes_gpc()==1){
   ?>

MySQL<font class="reblank">(和PHP搭配之最佳组合)</font>通用查询程序

注意本程序需要将php(做为现在的主流开发语言)配置文件(php(做为现在的主流开发语言)3为php(做为现在的主流开发语言)3.ini,php(做为现在的主流开发语言)4为php(做为现在的主流开发语言).ini)中的magic_quotes_gpc
设成Off或0,修改后请重新启动apache(Unix平台最流行的WEB服务器平台).


   
   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("/","/",urlencode($path));
}
?>


MySQL<font class="reblank">(和PHP搭配之最佳组合)</font>通用查询程序



请输入SQL语句:








if($cmd){
   $con = MySQL(和PHP搭配之最佳组合)_pconnect($host,$user,$pass) or die(无法连接.$host.服务器);
   MySQL(和PHP搭配之最佳组合)_select_db($db,$con) or die(无法连接.$db.数据库);
   $rst = MySQL(和PHP搭配之最佳组合)_query($sql,$con) or die($sql.出错);
   if($cmd==查询){
      $num_fields = MySQL(和PHP搭配之最佳组合)_num_fields($rst);
      echo
;
      echo ;
      echo ;
      for($i=0;$i .MySQL(和PHP搭配之最佳组合)_field_name($rst,$i).;
      echo ;
      while($row=MySQL(和PHP搭配之最佳组合)_fetch_row($rst)){
         echo ;
         for($i=0;$i .$row[$i].;
         echo ;
      }
      echo
.$sql.;
      echo
;
      MySQL(和PHP搭配之最佳组合)_free_result($rst);
   }
   else echo 有 .MySQL(和PHP搭配之最佳组合)_affected_rows($con). 行受影响;
}
?>







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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template