//鏈接數據庫
$conn = @mysql_connect("localhost","root","88888888") or die ("鏈接錯誤");
//解決中文亂碼
mysql_query("set names 'GBK'");
//打開數據庫
mysql_select_db("wordpress",$conn) or die("打開失敗");
$sql = "select * from wp_posts";
//執行sql語句
$result = mysql_query($sql,$conn);
//循環打印所需參數
while($row = mysql_fetch_array($result))
{
echo $row[4]."<br>";//測驗多次,$row[4]中只能為索引,不能為列名,郁悶中ing
}
摘自 燈下燭影