2006-03-22 00:25:05小友

php教學2-選取mysql資料

選擇資料庫

語法: mysql_select_db ("資料庫名稱");

例如:$db = mysql_select_db ("mysql");



查詢資料庫

語法:mysql_query("查詢字串",連接指標);

例如:$query="select * from mysql order by number desc";

$rows = mysql_query($query);

實際例子:

mysql_connect("localhost","root","123456");

$db = mysql_select_db("mysql");

$query="select * from mysql order by number desc";

$rows = mysql_query($query);