开源的PHPmysql:第15讲MySqli扩展.pptVIP

  • 0
  • 0
  • 约5.87千字
  • 约 23页
  • 2017-06-25 发布于四川
  • 举报
示例说明 上页例子中可以看出准备语句绑定结果的步骤大概是: 第一步:创建对象 ($stmt = $mysqli-stmt_init(); ) 第二步:准备语句($stmt-prepare(“sql语句”) 第三步:执行($stmt-execute(); ) 第四步:绑定结果 第五步:获取结果($stmt-fetch()) 第六步:关闭($stmt-close(); ) 注意:在绑定结果时方法bind_result可以有任意个参数但是要与你所查询的列数相匹配 绑定参数和结果示例 ?php $mysqli = new mysqli(localhost, user, password, test); $stmt = $mysqli-stmt_init(); $city = Amersfoort; if ($stmt-prepare(SELECT District FROM City WHERE Name=?)) { $stmt-bind_param(s, $city); $stmt-execute(); $stmt-bind_result($district); $stmt-fetch(); printf(%s is in district %s\n, $city, $district); $stmt-close(); } $mys

文档评论(0)

1亿VIP精品文档

相关文档