嘗試在Laravel中使用mysql_fetch_array()時出現錯誤。Laravel無法使用mysql_fetch_array()
while ($row = mysql_fetch_array($query))
什麼使用,而不是mysql_fetch_array()?
錯誤我,
mysql_fetch_array()預計參數1是資源,數組給定
完整部分,
//prepare the tag cloud array for display
$terms = array(); // create empty array
$maximum = 0; // $maximum is the highest counter for a search term
$query = DB::select('SELECT term, counter FROM search ORDER BY counter DESC LIMIT 30');
while ($row = mysql_fetch_array($query))
{
$term = $row['term'];
$counter = $row['counter'];
// update $maximum if this term is more popular than the previous terms
if ($counter > $maximum) $maximum = $counter;
$terms[] = array('term' => $term, 'counter' => $counter);
}
添加完整的東西 –
爲什麼?你爲什麼要這樣做???只需使用'DB'功能 – aynber
如何在這裏使用DB功能? D B::?? – Nim