0
mysql에서 travel_location 테이블의 모든 위치를 가져오고 싶습니다. 내 코드입니다sql php에서 모든 데이터 얻기
$select = $this->_db_table->select()->from(travel_location, array('*'));
$result = $this->_db_table->fetchAll($select);
if(count($result) == 0) {
throw new Exception('not found',404);
}
while ($row1 = mysql_fetch_array($result)){
$user_object = new Api_Model_User($row1);
$count = 1;
$json = array($json[$count] = array(
'travel_location_id' => $user_object->travel_location_id,
'city_id' => $user_object->city_id,
'user_id' => $user_object->user_id,
'location_name' => $user_object->location_name,
'description' => $user_object->description,
'longitude' => $user_object->longitude,
'latitude' => $user_object->latitude,
'created_time' => $user_object->created_time,
'updated_time' => $user_object->updated_time));
$count++;
}
작동하지 않습니다. $ row1 = mysql_fetch_array ($ result)를 출력하고 false를 반환하므로이 줄로 인해 잘못되었다고 생각합니다. 어떻게 해결할 수 있습니까?
에 대한 자세한 내용 :
이 시도? fetchAll()은 모든 행을 반환해야하며 mysql_fetch_array는 필요하지 않습니다. –
감사합니다. 그러나 나는 시험해 보았습니다. 그리고 그것은 단지 테이블에 대한 약간의 정보를 돌려줍니다. – Hai