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
相关文档:
import java.io.IOException;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class DES {
private byte ......
需要用的php的正规匹配汉字,在网上找了些文章看了以下,看到这个的时候感觉这篇文章写的很真实,忍不住转过来了。
原文地址:http://hi.baidu.com/comdeng/blog/item/f272362e47ce29564ec226c5.html
在javascript中,要判断字符串是中文是很简单的。比如:
var str = "php编程";
if (/^[\u4e00-\u9fa5]+$/.t ......
内容摘要:RSS 聚合最近非常流行,因此至少对 RSS 及其工作方式有所了解是一名 PHP 开发人员的迫切需要。本文介绍了 RSS 基础知识、RSS 众多用途中的一些用途、如何使用 PHP 从数据库创建 RSS 提要,以及如何使用 XML_RSS 模块读取现有 RSS 提要并将其转换为 HTML。
什么?您没听说过 RSS?
RSS 聚合是最常见的 ......
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays ......
test.php代码: view plaincopy to clipboardprint?
assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?>
assign("total",$t ......