我想知道我們是否需要使用select_db()
功能,當我們查詢數據庫,因爲我們已經定義我們要編寫查詢像"select * from users"
我們應該在php中使用select_db()嗎?
我想沒有它時所使用的表和它的工作,但我不知道知道功能提供了什麼樣的優點?
//$sau_db->select_db("users");
$query = "select * from users";
$results = $sau_db->query($query);
echo "<ul>";
for($i=0;$i < $results->num_rows; $i++)
{
$row = $results->fetch_assoc();
echo "<li>".$row["first_name"].' '.$row["last_name"]."</li>";
}
echo "</ul>";
你可以給代碼創建$ sau_db嗎?否則,我們無法確定您使用的數據庫抽象類型。 – SamT 2011-06-03 18:29:02