conn;public dbname="數(shù)據(jù)庫名稱";public username="數(shù)據(jù)庫用戶名";public password="數(shù)據(jù)庫密碼";public host="localhost";//連接數(shù)據(jù)庫 public function __construct(){ this-<conn=mysql_connect($this-<host,$this-<username,$this-<password);if(!$this-<conn){ die("連接失敗".mysql_error...
1連接數(shù)據(jù)庫 mysql_connect('localhost',‘root’,'123456');mysql_select_db('dbname');2提取特定id:$sql="select * from table_name where id in(1,2,3)";執(zhí)行sql獲得結(jié)果集,$result = mysql_query($sql);row = array();3循環(huán)輸出模板內(nèi)容,while($row=mysql_fetch_assoc($result))...