PHP有关数据库的连接

PHP有关数据库的连接笔记

1、 c o n = m y s q l c o n n e c t ( " l o c a l h o s t " , " p e t e r " , " a b c 123 " ) ; 数 据 库 连 接 2 、 m y s q l s e l e c t d b ( " 数 据 库 库 名 " , con=mysql_connect("localhost","peter","abc123"); 数据库连接 2、mysql_select_db("数据库库名", con=mysqlconnect("localhost","peter","abc123");2mysqlselectdb("",con); // 连接那个库
2、mysql_close( c o n ) ; / / 数 据 库 的 关 闭 3 、 m y s q l q u e r y ( " c r e a t e d a t a b a s e s m y d b " , con); //数据库的关闭 3、mysql_query("create databases my_db", con);//3mysqlquery("createdatabasesmydb",con); //向mysql输入函数
4、数据库的创建
create table persion(
persionId int not null auto_increment primary key,
name varchar(15),
age int ,
);
5、mysql_fetch_array(); //取出下一行的数据
例如:
while( r o w = m y s q l f e t c h a r r a y ( row= mysql_fetch_array( row=mysqlfetcharray(result)){
echo [ ′ f i r s t N a m e ′ ] . " " . ['firstName']." ". [firstName]."".row[‘lastName’];
echo “
”;

6、order by 关键词
asc 默认升序 desc 默认降序

7、odbc_exec( c o n , con, con,sql);

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

金石不渝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值