PHP新的连接MySQL方法mysqli
PHP新的连接MySQL方法mysqli
1. 开启PHP的API支持
(1)首先修改您的php.ini的配置文件。
查找下面的语句:
;extension=php_mysqli.dll
将其修改为:
extension=php_mysqli.dll
(2)重新启动Apache/IIS,即可。
(3)说明:PHP需要单独的文件来支持这个扩展库,一般在PHP目录下的ext目录里能找到php_mysqli.dll文件(PHP <=
5.0.2 中是
libmysqli.dll),当然,在PHP的配置文件当中要有正确指向ext的信息(extension_dir)。假若您的PHP没有这个文件,您
可以去下载PHP5的源码包。另外,这个API扩展,只能在PHP5以上版本使用。其它具体信息,请看下面。
2. mysqli身份证
mysqli是“MySQL, Improved”的缩写,该扩展仅适用于PHP 5。它能用于MySQL
4.1.1和更高版本。该扩展完全支持MySQL
5.1中采用的鉴定协议,也支持预处理语句和多语句API。此外,该扩展还提供了先进的、面向对象的编程接口。在http://php.net/mysqli
上,可找到关于mysqli扩展的文档。在http://www.zend.com/php5/articles/php5-mysqli.php
处,给出了一篇有用的文章。
3. mysqli预定义类
mysqli
表达了 PHP 和 MySQL 数据库之间的连接。
构造函数
mysqli - 构造一个新的 mysqli 对象
方法
autocommit - 打开或关闭自动提交的数据库选项
change_user - 改变指定的数据库连接的用户
character_set_name - 返回数据库连接的默认字符集
close - 关闭一个之前打开的连接
commit - 提交当前事务
connect - 打开一个到 MySQL 数据库服务器的新连接
debug - 执行排错操作
dump_debug_info - 取得排错信息
get_client_info - 返回客户端版本
get_host_info - 返回连接使用的类型
get_server_info - 返回 MySQL 服务器的版本
get_server_version - 返回 MySQL 服务器的版本
init - 初始化 mysqli 对象
info - 取得最近执行的查询的信息
kill - 要求服务器停止一个 mysql 线程
multi_query - 执行多个查询
more_results - check if more results exist from currently executed multi-query
next_result - reads next result from currently executed multi-query
options - set options
ping - pings a server connection or reconnects if there is no connection
prepare - prepares a SQL q
相关文档:
PHP 自定义函数实现系统函数功能
总是用别人写好的函数 是不是觉得不爽?好,下面跟着我来写吧~~以下代码全部由自己编写,绝无抄袭之嫌~~现贴上,仅供参考.(可能有些功能没有写全)
说明一下,写系统函数再拿来使用确实很蠢,但只是作为练习,还有,在面试时确实是算法考得多,网上找来的面试题也大都要靠算法\语法熟练才能 ......
MySQL Cluster
is a technology that enables
clustering of in-memory databases in a shared-nothing system. The
shared-nothing architecture allows the system to work with very
inexpensive hardware, and with a minimum of specific requirements
for hardware or software.
......
CREATE DEFINER=`root`@`%` FUNCTION `sp_cn`(n_LowerMoney decimal(15,2)) RETURNS varchar(200) CHARSET utf8
begin
Declare v_LowerStr VARCHAR(200) ;
Declare v_UpperPart VARCHAR(200) ;
Declare v_UpperStr VARCHAR(200) ;
Declare i_I int ;
set v_LowerStr = LTRIM(RTRIM(ROUND(n_LowerMoney,2 ......
一. 首先做一个简单的so文件:
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared ......
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->ge ......