Home > php教程 > php手册 > body text

学习php中的mysql()函数

WBOY
Release: 2016-06-13 11:31:39
Original
1011 people have browsed it

连接数据库服务器语句;

3.mysql_query(1,2):(1)sql语句,(2)连接标识符,没有的话则使用上一个连接数据库服务器语句;

4.设置编码语句:(1)mysql_query("set names 'utf8'");(2)mysql_set_charset('utf8');(没有设置时出现乱码);

5.mysql_fetch_array(1,2):(1)指定的数据指针,通过mysql_query()函数返回;(2)可选参数,数组类型(MYSQL_ASSOC/MYSQL_NUM/MYSQL_BOTH),默认为MYSQL_BOTH,包含关联型数组与数值型数组;注意:当指定的数据获取之后,该函数将指定下一条记录,如果继续请求该函数,则返回下一条记录;官网说此函数返回的字段名大小写敏感,试验了一下并不敏感,当然是在windows XP操作系统,其它系统尚不知道;

6.mysql_free_result(data):释放结果内存,data是从mysql_query()返回的结果;仅需要在考虑返回很大结果集时会占用多少内存时调用,脚本结束时所有关联的内存都会被自动释放(不明白不理解);

 

 

 

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!