您现在的位置: 首页  > MySQL > 基础知识
通行证登录
 

MySQL学习教程:测试mysql的绑定变量功能

作者:[网上资料 ]
在连接oracle数据库的时候大多都会使用绑定变量技术,oracle的绑定变量的功能大家非常喜欢,因为它能提高数据库的性能,在数据库优化的时候也能获得更多更详细的信息。 在关于mysql是否支持绑定变量功能,和mysql的绑定变量功能是不是鸡肋的说法和讨论比较多,今天我我们就做个小实验,测试下php+mysql的绑定变量功能是否能够提高web和mysql的性能,提高的比率有多少。 测试方法,主要采取,在绑定变量前后对PHP脚本的执行时间的测试,和pfiles工具对sql语句执行的资源使用情况统计。测试环境如下: RHEL5.4mysql> select version();+------------+| version()  |+------------+| 5.1.44-log |+------------+[root xxx]# php -versionPHP 5.2.10 with Suhosin-Patch 0.9.7 (cli) (built: Aug 13 2010 09:14:57) Copyright (c) 1997-2009 The PHP GroupZend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies 绑定变量测试,插入10条记录句执行10次,每次数据库所用时间如下(使用profile计算,见mysqli_stmt.php): 0.0001020.0000930.0001020.0001020.0000940.000130.0001020.00010.0001380.000095总共平均时间:0.0001058使用linux time命令计算绑定变量的php脚本执行时间real    0m0.039suser    0m0.024ssys     0m0.013sreal    0m0.041suser    0m0.027ssys     0m0.011sreal    0m0.039suser    0m0.025ssys     0m0.012sreal    0m0.039suser    0m0.026ssys     0m0.012sreal    0m0.040suser    0m0.021ssys     0m0.019sreal    0m0.040suser    0m0.029ssys     0m0.010sreal    0m0.039suser    0m0.020ssys     0m0.018sreal    0m0.040suser    0m0.025ssys     0m0.013sreal    0m0.039suser    0m0.029ssys     0m0.009sreal    0m0.040suser    0m0.026ssys     0m0.014s平均执行时间:0.0395s不使用绑定变量测试,插入10条记录句执行10次,每次数据库所用时间如下(使用profile计算,见mysqli_nobind.php): 0.0001030.0001040.0001140.0001030.0001190.0001130.0001140.0001020.000120.00012平均执行时间:0.000112使用linux time命令计算不绑定变量的php脚本执行时间:real    0m0.040suser    0m0.026ssys     0m0.014sreal    0m0.040suser    0m0.027ssys     0m0.011sreal    0m0.039suser    0m0.028ssys     0m0.009sreal    0m0.040suser    0m0.027ssys     0m0.011sreal    0m0.039suser    0m0.023ssys     0m0.015s平均执行时间(由于精度影响,所以看不出差别,也就是在网站压力小的时候可以忽略):0.0395s结论:(未绑定变量的sql平均执行时间-绑定变量sql的平均执行时间)/未绑定变量的执行时间=0.0553571428571429约为6%。总体提升了6%左右的性能。由于性能提升不是太大,加上时间敏感度太高,我就不接着往下挖掘在执行哪步骤出现的时间差别了,根据现有日志观察,在开始执行语句以后的一切操作应该是一样的,包括打开表,获得锁资源,执行语句,记录日志,释放资源等。不过对于绑定变量的可用性还是不容怀疑的,在大型系统上5%的性能提高已经很不错了,加上绑定变量的安全性,可以很好的规范SQL语句的验证,避免自己单独去写验证语句,推荐使用绑定变量。 一下是测试用的两个PHP脚本,修改下数据库账号和密码,就可以在本地使用。650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">[root@zj7 learn_php]# cat mysqli_stmt.php    650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"><?php 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $mysqli=new mysqli("localhost", "root", "123321", "test"); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sql1="set @@profiling=1"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $result1=$mysqli->query($sql1); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //准备好一条语句放到服务器中,插入语句 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sql="insert into t(name,sex) values (?,?)"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt=$mysqli->prepare($sql); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //给占位符号每个?号传值(绑定参数) i    d    s    b    650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->bind_param("si", $name, $sex); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="andy"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=0; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="mandy"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="michael"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=0; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="happy"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="php"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="mysql"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="linux"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="oracle"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="unix"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $name="cisco"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sex=1; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                //执行 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->execute(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $stmt->close(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sql2="show profiles"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $result2=$mysqli->query($sql2); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                echo '<table border=1 align="center" width=800>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                while($rows=$result2->fetch_assoc()){ 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                echo '<tr align="center">'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                foreach($rows as $value){ 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                                echo '<td>' . $value    . '</td>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                } 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                echo '</tr>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                $i=0; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                $i=$i+$rows["Duration"]; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                } 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                echo '</table>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                echo $i; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">?>  650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">[root@zj7 learn_php]# cat mysqli_nobind.php            650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"><?php 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $mysqli=new mysqli("localhost", "root", "123321", "test"); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sql1="set @@profiling=1"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $result1=$mysqli->query($sql1); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $nobind=array("insert into t(name,sex) values ('andy',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('mandy',1)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('michael',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('happy',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('php',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('mysql,0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('linux',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('oracle',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('cisco',0)", 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                "insert into t(name,sex) values ('unix',0)"); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                foreach($nobind as $sql){ 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                echo $sql; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                 $result=$mysqli->query($sql); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                } 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $sql2="show profiles"; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $result2=$mysqli->query($sql2); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif"> 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                echo '<table border=1 align="center" width=800>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                while($rows=$result2->fetch_assoc()){ 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                echo '<tr align="center">'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                foreach($rows as $value){ 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                                echo '<td>' . $value    . '</td>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                } 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                echo '</tr>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                $i=0; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                                $i=$i+$rows["Duration"]; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                } 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                echo '</table>'; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                echo $i; 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">                $mysqli->close(); 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' alt="" align=top src="http://www.jzxue.com/System/uploads/allimg/110223/0930140.gif">?> |