function random()
{
$anketadb = $this->load->database('anketa',TRUE);
$br = $anketadb->count_all_results('anketadata');
$nmb = mt_rand(1,$br);
if ($nmb != 1){
$nmb = $nmb - 1;
}
$count = $anketadb->get('anketadata', 1, $nmb);
return $count;
}
Why this code when i echo it in View returns ERROR:笨隨機行的MySQL無錯誤對象無法轉換爲字符串
A PHP Error was encountered
Severity: 4096
Message: Object of class CI_DB_mysqli_result could not be converted to string
Filename: ankete/rezultatiankete.php
Line Number: 52
謝謝,而不是如何迴應它,以某種方式提示foreach? – Daniela
是的,在foreach裏只是回顯列名像'回聲$ row-> fieldname;' –
但是這是模型,所以在視圖中,你可以告訴我該怎麼做? – Daniela