All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
datareader显示很快的分页程序实例_[Asp.Net教程]
DateDiff,方法在C#中的实现_[Asp.Net教程]
无废话C#设计模式之七:Adapter_.net资料_编程技术
asp.net2.0服务器控件之ImageButton控件
提高SQL,Server安全性的一些建议_mssql学习_编程技术
SQL,Server,2005,CE软件环境需求_mssql学习_编程技术
在MySQL中定义外键_php资料_编程技术
用PHP将整个网站生成HTML_php资料_编程技术
用javascript的ShowModalDialog()函数去显示一个aspx页面时缓存的问题_JavaScript技术_编程技术
从VS2003(.net1.1)升级到vs2005(.net2.0)全程跟踪记录_[Asp.Net教程]
Reading number is top 10 pictures
Hunan province aizhai super-large suspension bridge open to traffic and 4 world first2
Black and white also sexy--YanLiu1
Take you to walk into the most true north Korea rural1
A beautiful girl to bud3
采访美女孙菲菲
Sora aoi in China2
So beauty, will let you spray blood8
In 2013 hercules Arnold classic2
Summer is most suitable for young people to travel in China1
含苞欲放的素颜美少女3
Download software ranking
Ashlynn Video3
Unix video tutorial7
致我们终将逝去的青春
尖东毒玫瑰B
Tram sex maniac 2 (H) rar bag1
Unix video tutorial3
jdk1.6 for windows
Tram sex maniac 2 (H) rar bag5
双旗镇刀客A
WebService在.NET中的实战应用教学视频 → 第5集
aaa published in(发表于) 2013/12/21 22:34:41 Edit(编辑)
PHP连接MYSQL的两种方法_php资料_编程技术

PHP连接MYSQL的两种方法_php资料_编程技术

PHP连接MYSQL的两种方法_php资料_编程技术-你的首页-uuhomepage.com
  mysql可通过两种方式通过PHP与web相连,一种通过php的mysql相关函数,另一种通过php的ODBC相关函数

相关函数如下:

MYSQL函数

mysql_affected_rows: 得到 MySQL 最后操作影响的列数目。
mysql_close: 关闭 MySQL 伺服器连线。
mysql_connect: 开启 MySQL 伺服器连线。
mysql_create_db: 建立一个 MySQL 新资料库。
mysql_data_seek: 移动内部传回指标。
mysql_db_query: 送查询字串 (query) 到 MySQL 资料库。
mysql_drop_db: 移除资料库。
mysql_errno: 传回错误讯息代码。
mysql_error: 传回错误讯息。
mysql_fetch_array: 传回阵列资料。
mysql_fetch_field: 取得栏位资讯。
mysql_fetch_lengths: 传回单列各栏资料最大长度。
mysql_fetch_object: 传回物件资料。
mysql_fetch_row: 传回单列的各栏位。
mysql_field_name: 传回指定栏位的名称。
mysql_field_seek: 设定指标到传回值的某栏位。
mysql_field_table: 获得目前栏位的资料表 (table) 名称。
mysql_field_type: 获得目前栏位的型态。
mysql_field_flags: 获得目前栏位的旗标。
mysql_field_len: 获得目前栏位的长度。
mysql_free_result: 释放传回占用记忆体。
mysql_insert_id: 传回最后一次使用 INSERT 指令的 ID。
mysql_list_fields: 列出指定资料表的栏位 (field)。
mysql_list_dbs: 列出 MySQL 伺服器可用的资料库 (database)。
mysql_list_tables: 列出指定资料库的资料表 (table)。
mysql_num_fields: 取得传回栏位的数目。
mysql_num_rows: 取得传回列的数目。
mysql_pconnect: 开启 MySQL 伺服器长期连线。
mysql_query: 送出一个 query 字串。
mysql_result: 取得查询 (query) 的结果。
mysql_select_db: 选择一个资料库。
mysql_tablename: 取得资料表名称。
ODBC函数

使用ODBC函数需安装MYSQL ODBC

odbc_autocommit: 开关自动更动功能。
odbc_binmode: 设定二进位资料处理方式。
odbc_close: 关闭 ODBC 连结。
odbc_close_all: 关闭所有 ODBC 连结。
odbc_commit: 更动 ODBC 资料库。
odbc_connect: 连结至 ODBC 资料库。
odbc_cursor: 取得游标名。
odbc_do: 执行 SQL 指令。
odbc_exec: 执行 SQL 指令。
odbc_execute: 执行预置 SQL 指令。
odbc_fetch_into: 取得传回的指定列。
odbc_fetch_row: 取得传回一列。
odbc_field_name: 取得栏位名称。
odbc_field_type: 取得栏位资料形态。
odbc_field_len: 取得栏位资料长度。
odbc_free_result: 释出传回资料的记忆体。
odbc_longreadlen: 设定传回栏的最大值。
odbc_num_fields: 取得栏位数目。
odbc_pconnect: 长期连结至 ODBC 资料库。
odbc_prepare: 预置 SQL 指令。
odbc_num_rows: 取得传回列数目。
odbc_result: 取得传回资料。
odbc_result_all: 传回 HTML 表格资料。
odbc_rollback: 撤消当前交易。
odbc_setoption: 调整 ODBC 设定。

例子可见我在本网站的"程序与代码"里的文章和下面的例程:

前台HTML

< form enctype="multipart/form-data" action="hb_ggzd.php" method="post" >
< tr >
< td width="251" >< small >您 可 以 花 些 时 间 填 写 下 表 , 也 可 以 用 电
子 邮 件 联 系 ,< a href="mailto:likai333@21cn.com" >likai333@21cn.com< /a >。< /small >< /td >
< /tr >
< tr >
< td vAlign="top" width="251" height="31" >< small >您的姓名:< /small >< /td >
< td width="462" height="31" >< small >< input name="name" size="20" > < /small >< /td >
< /tr >
< tr >
< td vAlign="top" width="251" height="30" >< small >您的电子邮件:< /small >< /td >
< td width="462" height="30" >< small >< input name="usermail" size="37" >< /small >< /td >
< /tr >
< tr >
< td vAlign="top" width="251" height="25" >< small >您欲做广告的网站地址:< /small >< /td >
< td width="462" height="25" >< small >< small >< input name="userurl" size="37" value="http://" >< /small >< /small >< /td >
< /tr >
< tr >
< td vAlign="top" width="251" height="25" >< small >您欲做广告的网站站名:< /small >< /td >
< td width="462" height="25" >< small >< input name="sitename" size="20" >< /small >< /td >
< /tr >
< tr >
< td vAlign="top" width="251" height="30" >< small >您的公司名称:< /small >< /td >
< td width="462" height="30" >< small >< input name="company" size="37" >< /small >< /td >
< /tr >
< tr >
< td vAlign="top" width="251" height="25" >< small >您的联系电话:< /small >< /td >
< td width="462" height="25" >< small >< input name="phone" size="20" >< /small >< /td >
< /tr >
< tr >

后台PHP

< ?php
= mysql_connect('localhost:3306','root','');
mysql_select_db('HBWEB');
="insert into usemsg ( name,usermail,userurl,sitename, company,phone) values ('','','', '', '','','','','','','')";
= mysql_query(, );
= mysql_error();
if(){
echo "发生错误,请通知< a href=mailto:likai333@21cn.com >我< /a >";
echo "";
}
else
{ echo "成功入库"; }

? >

表结构:

CREATE TABLE usemsg (
name varchar(255) not null default "notname",
usermail varchar(255) not null default "notusermail",
userurl varchar(255) not null default "notuserurl",
sitename varchar(255) not null default "notsitename",
company varchar(255) not null default "notcompany",
phone varchar(255) not null default "notphone",
);




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.