All articles
|
All Pictures
|
All Softwares
|
All Video
|
Go home page
|
Write articles
|
Upload pictures
Reading number is top 10 articles
如何授予对存储过程的权限_[SQL Server教程]
PHP中与数组相关的函数摘录_php资料_编程技术
GridView每页添加不重新开始序号列_[Asp.Net教程]
Ajax简单应用,检测用户名是否存在_[AJAX教程]
ASP.NET从零起步设计网站全过程(4)_[Asp.Net教程]
使用AJAX技术打造博客无刷新搜索引擎_[AJAX教程]
delphi DeleteFile 函数删除硬盘中的文件
让没有安装.NET,Framwork的机器运行.NET,程序_[Asp.Net教程]
《SQL,Server,2005技术内幕:T-SQl查询》:常见sql问题归类解答_mssql学习_编程技术
SQLServer2005数据库还原到SQLServer2000_[SQL Server教程]
Reading number is top 10 pictures
Terrorist smile the largest human history an explosion1
The real super beauty5
Sora aoi mirror memorial classics1
Entered the goddess in the AD1
Group of female porn in 《westwards》, uninhibited woman threatened to not the bottom line2
战场废物1
BingBingFan apple dew point photo gallery5
Hunan road lawenforcement vehicle pursue overload car caused the car turn and man is died
From China fortress sora aoi1
NeedWallpaper12
Download software ranking
Boxer's Top ten classic battle9
jBuilder2006
Tram sex maniac 2 (H) rar bag7
WebService在.NET中的实战应用教学视频 → 第4集
Photoshop 8.0图象编辑软件
Unix video tutorial13
C++教程第四版
linux初级教程
Professional killers2 data package
终极变速大师Speeder3.26
aaa
published in(发表于) 2013/12/21 22:37:24
Edit(编辑)
如何在十天学内会php之第四天_php资料_编程技术
如何在十天学内会php之第四天_php资料_编程技术
如何在十天学内会php之第四天_php资料_编程技术-你的首页-uuhomepage.com
学习目的:学会连接数据库
我这里就简单说一下连接MYSQL数据库。
1、mysql_connect
打开 MySQL 服务器连接。
语法: int mysql_connect(string [hostname] [:port], string [username], string [password]); 返回值: 整数
本函数建立与 MySQL 服务器的连接。其中所有的参数都可省略。当使用本函数却不加任何参数时,参数 hostname 的默认值为 localhost、参数 username 的默认值为 PHP 执行行程的拥有者、参数 password 则为空字符串 (即没有密码)。而参数 hostname 后面可以加冒号与端口号,代表使用哪个端口与 MySQL 连接。当然在使用数据库时,早点使用 mysql_close() 将连接关掉可以节省资源。
2、 mysql_select_db
选择一个数据库。
语法: int mysql_select_db(string database_name, int [link_identifier]); 返回值: 整数
本函数选择 MySQL 服务器中的数据库以供之后的资料查询作业 (query) 处理。成功返回 true,失败则返回 false。
最简单的例子就是:
$conn=mysql_connect ("127.0.0.1", "", "");
mysql_select_db("shop");
连接机MY SQL数据库,打开SHOP数据库。在实际应用中应当加强点错误判断。
今天就说到这里,明天再说一下数据库的读取。
Disclaimer
Privacy Policy
About us
Site Map
If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.