當我們應該使用php獲取大約200個數據庫條目並使用html將它們顯示在頁面中時,最好的方法是什麼。現在我正在這樣做<?php echo $variable1?;>,,,,<?php echo $variable200;?>
,覺得它的加載速度慢。請選擇其他方式嗎通過html獲取並顯示大量php變量的正確方法
型號:
$query_str = "select *from table where sl_no='$report_id' and code='$code'";
$row=$query->row_array();
return $row;
控制器:
$reports=$this->patient_model->fetch_previous_reports($pat_lab_id);
echo json_encode($reports);
需要更多的代碼,看看你在做什麼。 –
以數組格式獲取值。並列出來 –
使用Foreach - http://php.net/manual/en/control-structures.foreach.php循環訪問數組值,所以你有'$ var [0]'...'$ var [199]'作爲一個有組織的數據陣列 – Martin