网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > 代码交流
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

代码交流 ASP,PHP,JSP等网站源代码下载与交流。

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 218.2.29.60
Old 2006-12-15, 08:13 PM
sunshine sunshine is offline
高级会员
 
Join Date: 2006-01-05
Posts: 368
sunshine 正向着好的方向发展
Default 十天学会php之第五天

学习目的:学会读取数据

先看两个函数:
1、mysql_query
送出一个 query 字符串。 语法: int mysql_query(string query, int [link_identifier]); 返回值: 整数

本函数送出 query 字符串供 MySQL 做相关的处理或者执行。若没有指定 link_identifier 参数,则程序会自动寻找最近打开的 ID。当 query 查询字符串是 UPDATE、INSERT 及 DELETE 时,返回的可能是 true 或者 false;查询的字符串是 SELECT 则返回新的 ID 值,当返回 false 时,并不是执行成功但无返回值,而是查询的字符串有错误。

2、mysql_fetch_object 返回类资料。 语法: object mysql_fetch_object(int result, int [result_typ]); 返回值: 类

本函数用来将查询结果 result 拆到类变量中。若 result 没有资料,则返回 false 值。

看一个简单的例子:
username.;
}
?>
当然,表user中有一个username的字段,这就类似asp中的

rs.movenext
loop
%>
当然先要连接数据库,一般我们 require_once(conn.php);而conn.php里面就是上一次说的连接数据库的代码。

小小的两条命令可以完成读取数据的工作了,今天说到这里下一次说数据的添加删除修改。
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:08 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.