PHP 操作Access (正确)
第一种方法:
<?php
class Access{
function getConn(){
$conn = @new COM("ADODB.Connection") or die ("ADO连接失败!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath(__IMPL__."/db2.mdb");
$conn->Open($connstr);
return $conn;
}
}
?>
操作:
写:
$sql="insert into stu (name) values ('$name')";
$rs = $conn->Execute($sql);
读:
$rs=$conn->Execute('select * from stu');
while(!$rs->EOF){
$id=$rs->fields['id']->value;
$name=$rs->fields['name']->value;
$rs->movenext();
}
$rs->close();
$conn->close();
改:
$sql="update stu set age='".$age."' where id=".$id;
$rs=$conn->Execute($sql);
$conn->close();
删:
$sql="delete from stu where id=".$id;
$rs = $conn->Execute($sql);
$conn->close();
方法二:
<?php
class Access1{
function getConn(){
$connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=".realpath(__IMPL__."/db2.mdb");
&nbs
相关文档:
编写关于 PHP 的系列文章让我更加深刻地了解了 PHP 开发人员的世界。我和许多 PHP 程序员交谈过,最令我惊奇的是只有很少的人使用 IDE。大多数程序员使用文本编辑器,比如 Microsoft® Windows® 上的记事本、Emacs 或者 Vim。
我提到的这些文本编辑器(以及我没提到)都是很不错的 —— 我不想讨论 ......
Zend-PHP编码规范
1.对于只包含PHP的文件,"?>"是不允许存在的。注释:防止末尾被意外的注入空白并显示输出。
2.缩进应使用四个空格的缩进,而不使用制表符TAB。
3.一行80个字符是比较合适的,最多为120字符。
4.行的结束符只能是标准的UNIX文本文件的换行,换行符在文件中表示为10,或16进制的 0x0A。
不要使用win ......
1.echo();2.print();3.die();4.printf();5.sprintf();6.print_r;7.var_dump();
1.echo()
输出多个字符串,可以多个参数,不需要圆括号,无返回值。
2.print()
只能输出一样东西,需要圆括号,有返回值,执行失败是返回flase.
3.die()
输出内容,停止程序。*多用于数据库的链接时,检验是否出错。
4.printf()
prin ......
最近在CSDN刚开了这个博客,没什么时间把以前写的文章搬过来,只能有空慢慢来了。
--------------------------这篇文章仅献给那些一直在PHP乱码问题上困惑的人。
A.首先说下HTML中文乱码问题的解决方法。
比如有个index.html的页面(这里是指真正的静态页面,修改服务器的……伪静态的请看方案B)
1. ......
HTML clipboard
Presidential edition double action fingerprint and access code security door
lock for your office, business or home. Get 100% safety at your entry point with
this maximum security style deadbolt double action lock.
This is one of the best and most secure methods in assuri ......