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);
原文地址:http://www.cnblogs.com/ZH1132672711/p/3755786.html