在wamp下的开发环境,查找资料有两种方法。使用query,使用prepare。看的代码是第二种,网上说第二种效率高,并且安全。
总结使用方法:
$sth = $dbh->prepare('update db set zh_CN= :str where SN=:SN');
$sth->bindParam(':str',$str,PDO::PARAM_STR,12);
$sth->bindParam(':SN',$SN);
$sth->execute();
$sth->lastInsertId();
$sth->closeCursor();
源代码使用bindValue(),lastInsertId()返回id。
上一篇: centos安装初体验,搭建apache-php-mysql
下一篇: wamp搭建环境不能ip访问的解决办法
相关文章:
- windows下django学习笔记二-常用命令
- Google jsAPI托管你的js库
- Django web : CSRF verification failed. Request aborted.
- Django判断数据库中是否有该记录
- django apache配置小记
- Ubuntu安装配置Apache和mod_wsgi
Categories: 博客记录
0 Responses so far.