MySQL通用查询程序
来源:互联网 发布:sql注入攻防入门详解 编辑:程序博客网 时间:2024/05/17 09:27
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
?>
<html>
<head><title>MySQL通用查询程序</title></head>
<body>
注意本程序需要将PHP配置文件(PHP3为php3.ini,PHP4为php.ini)中的magic_quotes_gpc
设成Off或0,修改后请重新启动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">
请输入SQL语句:<br>
<textarea name="sql" cols="100" rows="5"><?echo $sql;?></textarea><br>
<input type="submit" name="cmd" value="查询">
<input type="submit" name="cmd" value="执行">
</form>
<?
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 '<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> '.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> '.$row[$i].'</td>';
echo '</tr>';
}
echo '</table>';
MySQL_free_result($rst);
}
else echo '有 '.MySQL_affected_rows($con).' 行受影响';
}
?>
</body>
</html>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
if(get_magic_quotes_gpc()==1){?>
<html>
<head><title>MySQL通用查询程序</title></head>
<body>
注意本程序需要将PHP配置文件(PHP3为php3.ini,PHP4为php.ini)中的magic_quotes_gpc
设成Off或0,修改后请重新启动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">
请输入SQL语句:<br>
<textarea name="sql" cols="100" rows="5"><?echo $sql;?></textarea><br>
<input type="submit" name="cmd" value="查询">
<input type="submit" name="cmd" value="执行">
</form>
<?
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 '<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> '.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> '.$row[$i].'</td>';
echo '</tr>';
}
echo '</table>';
MySQL_free_result($rst);
}
else echo '有 '.MySQL_affected_rows($con).' 行受影响';
}
?>
</body>
</html>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- MySQL通用查询程序
- mysql的通用查询日志
- Mysql分页查询通用存储过程
- Mysql分页查询通用存储过程
- mysql分页查询通用存储过程
- Mysql分页查询通用存储过程
- Mysql分页查询通用存储过程
- mysql--通用日志(查询日志)
- MySQL 通用查询日志(General Query Log)
- MySql中通用查询处理流程
- MySQL 通用查询日志(General Query Log)
- MySQL查询优化程序
- MySQL查询优化程序
- 关于MySQL 通用查询日志和慢查询日志分析
- 关于MySQL 通用查询日志和慢查询日志分析
- 关于MySQL 通用查询日志和慢查询日志分析
- Mysql通用查询操作类(Jsp+servlet+javaBean+Mysql)
- 通用查询
- 用C#实现基于用C#实现基于TCP协议的网络通讯
- pop3邮件收取一例
- 转贴:用ASP.NET结合XML制作广告管理程序
- smtp邮件发送一例
- DataList控件也玩分页 (转自aspcn.com)
- MySQL通用查询程序
- C#排序算法大全
- 一个简单的图形计数器
- .NET几大热点问题(转)
- 一个自定义位数的多用户计数器
- C#的4个基本技巧
- 一个模仿oso的论坛程序(之三)
- 六种快速修理C# Bug的方法
- 一个模仿oso的论坛程序(之一)