易截截图软件、单文件、免安装、纯绿色、仅160KB

php mysqli 使用prepare

  1,绑定参数
 
  $mysqli=new mysqli($host,$user,$pass,$db);  
   if(mysqli_connect_errno()){  
    echo '连接出现异常了:'.mysqli_connect_error();  
    exit(0);  }  
      
   $sql = 'insert into user(name,pass,email) values(?,?,?)';  
   $stmt = $mysqli->prepare($sql);  
   $stmt->bind_param('sss',$name,$paassword,$email);  
   $name= '2';  
   $paassword=md5('12345');  
   $email = 'iamtsgx08@google.com';     
   $stmt->execute();  
     
   echo '修改了'.$stmt->affected_rows.'行';  
     
   $stmt->close();  
   $mysqli->close();
2,绑定结果集
$sql = 'select name,pass,email from user';  
  if($stmt = $mysqli->prepare($sql)){  
    $stmt->execute();  
    $stmt->bind_result($name,$pass,$email); //绑定结果  
    echo "<table>";  
    while($stmt->fetch()){  
        echo "<tr>";  
        echo "<td>".$name."</td>";  
        echo "<td>".$pass."</td>";  
        echo "<td>".$email."</td>";  
        echo "</tr>";  
    }  
    echo "</table>";  
    $stmt->close();  
  }  
   &nbs


相关文档:

php smarty基本使用

1.基本类
//smarty_config.php
<?php
define('TEMPLATE_DIR','templates/');
define('COMPILE_DIR','templates_c/');
define('CONFIG_DIR','configs/');
define('CACHE_DIR','cache/');
?>
//View.class.php
<?php
//配置文件
require_once 'configs/smart_config.php';
//Smarty类
require('smarty/ ......

php常用的一个常量

php中DIRECTORY_SEPARATOR 与 PATH_SEPARATOR的区别
DIRECTORY_SEPARATOR:路径分隔符,linux上就是’/’    windows上是’\’
PATH_SEPARATOR:include多个路径使用,在win下,当你要include多个路径的话,你要用”;”隔开,但在linux下就使用”:”隔开的。
这2个常 ......

结合使用PHP和RSS(转)


内容摘要:RSS 聚合最近非常流行,因此至少对 RSS 及其工作方式有所了解是一名 PHP 开发人员的迫切需要。本文介绍了 RSS 基础知识、RSS 众多用途中的一些用途、如何使用 PHP 从数据库创建 RSS 提要,以及如何使用 XML_RSS 模块读取现有 RSS 提要并将其转换为 HTML。
  什么?您没听说过 RSS?
  RSS 聚合是最常见的 ......

PHP分页

分页类    
   
  /**********  
  |   +---------------------------------------------------  
  |   CLASS   NAME:   PageBar  
  |   +---------------------------------------------------  
  |   Au ......

一个比较完善的PHP购物车类

<?
/*****************************************************************************/
/* */
/* file type: 包含文件,建议后缀为.inc */
/* */
/* file name: cart.inc */
/* */
/* Description: 定义一个购车类 */
/* */
/* Func list : class cart */
/* */
/* author : bigeagle */
/* */ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号