我有一个页面,我想从数据库中显示数据。无法将数据打印到“查看”
我可以print_r($sale)
它显示的数据,我后 - $ sale是在控制器中设置,但我似乎无法做<?php $sale['name'] ?>
它什么也没有显示。
的print_r:
Array ([0] => stdClass Object ([id] => 48 [name] => Jess McKenzie [location] => Auckland [bedrooms] => 5 [bathrooms] => 1 [condition] => Fair [description] =>
hii
[price] => 30.00000 [imagename] => purple.jpg [thumbname] => purple_thumb.jpg) [1] => stdClass Object ([id] => 49 [name] => jzmwebdevelopment [location] => Auckland [bedrooms] => 15 [bathrooms] => 4 [condition] => OK [description] =>
zebra
[price] => 25.00000 [imagename] => Zebra.jpg [thumbname] => Zebra_thumb.jpg))
型号:
function getSalesContent($id = NULL) {
$this->db->where('id', $id);
$query = $this->db->get('sales', 1);
if($query->num_rows() > 0) {
$row = $query->result_array();
return $row;
}else{
return FALSE;
} # End IF
} # End getSalesContent
你可以张贴的print_r($销售)的结果? – Dalen 2011-05-04 19:18:52
完成此表示感谢 – 2011-05-04 19:26:21