1.連接數(shù)據(jù)庫
2.執(zhí)行查詢
3.獲取結(jié)果
1.連接數(shù)據(jù)庫
$con = new mysqli();
$con->real_connect('host','user','password','dbname'); //成功時(shí)返回true
2.執(zhí)行查詢
$result = $con->query('select * from table'); 失敗時(shí)返回false,成功時(shí)SELECT, SHOW, DESCRIBE or EXPLAIN這些命令返回一個(gè)對(duì)象,其他命令返回true
$result = $con->real_query('select * from table'); //成功時(shí)返回true虹曙,失敗時(shí)返回false
3.獲取結(jié)果
$result->fetch_all($type); //獲取所有結(jié)果,$type可選 1滑凉、2、3贫橙,分別為關(guān)聯(lián)數(shù)組贪婉、索引數(shù)組、索引數(shù)組和關(guān)聯(lián)數(shù)組