$max_id = $this->api_model->select_a_field_with_where("max(id)", "api_blog", "id > 0"); $sql="Select title_en,title_kh, description_en, description_kh, from tblmenu where title_en='About Us'"; $query=$this->db->query($sql); if($query->num_rows() >0){ $i=0; foreach($query->result() as $row){ $i++; echo ''; } } $query->free_result(); $query2 = $this->db->query('SELECT name FROM some_table'); $row = $query2->row(); echo $row->name; $query2->free_result(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $temp[] = $row; printf("ID: %s Name: %s", $row["id"], $row["name"]); } foreach ($temp as $key => $value) { echo $key."=".$value."
"; } while ($row = mysql_fetch_array($result, MYSQL_NUM)) { array_push($array_key, $row[0]); } while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { // printf ("ID: %s Name: %s", $row[0], $row["name"]); } $con = mysql_connect(constant("host_api"),constant("user_api"),constant("password_api")); mysql_select_db(constant("db_api"), $con); $result = mysql_query("select ".$field_name." from ".$table_name." where ".$where_field_name); if($result === FALSE) { die(mysql_error()); // TODO: better error handling } while($row = mysql_fetch_array($result)) { return $row[$field_name]; } mysql_free_result($result); mysql_close($con);