>  기사  >  데이터 베이스  >  MySQL通用查询程序_MySQL

MySQL通用查询程序_MySQL

WBOY
WBOY원래의
2016-06-01 14:04:51947검색

MySQL查询


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

MySQL通用查询程序

注意本程序需要将PHP配置文件(PHP3为php3.ini,PHP4为php.ini)中的magic_quotes_gpc
设成Off或0,修改后请重新启动Apache.



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));
}
?>


MySQL通用查询程序


请输入SQL语句:






if($cmd){
$con = mysql_pconnect($host,$user,$pass) or die('无法连接'.$host.'服务器');
mysql_select_db($db,$con) or die('无法连接'.$db.'数据库');
$rst = mysql_query($sql,$con) or die($sql.'出错');
if($cmd=='查询'){
$num_fields = mysql_num_fields($rst);
echo '


';
echo '';
echo '';
for($i=0;$i '.mysql_field_name($rst,$i).'';
echo '';
while($row=mysql_fetch_row($rst)){
echo '';
for($i=0;$i '.$row[$i].'';
echo '';
}
echo '
'.$sql.'';
echo '
';
mysql_free_result($rst);
}
else echo '有 '.mysql_affected_rows($con).' 行受影响';
}
?>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.