尝试在 Laravel 中使用 mysql_fetch_array() 时出现错误。
while ($row = mysql_fetch_array($query))
Run Code Online (Sandbox Code Playgroud)
用什么来代替 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 …Run Code Online (Sandbox Code Playgroud)