链接数据库

时间:2014-06-29 14:11:36   收藏:0   阅读:288
1 //生成一个连接
 2 $db_connect=mysql_connect($dbhost,$username,$userpass) or die("Unable to connect to the MySQL!");
 3 
 4 //选择一个需要操作的数据库
 5 mysql_select_db($dbdatabase,$db_connect);
 6 
 7 //执行MySQL语句
 8 $result=mysql_query("SELECT id,name FROM user");
 9 
10 //提取数据
11 $row=mysql_fetch_row($result);

链接数据库,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!