$query = $this->db->select (' Select dep_id, dep_name from Xy_departments ORDER by dep_id ASC ');
How did the $query of the query come into
$data = Array (
' Finance ' and ' finance ',
' Philosophy ' = ' philosophy '
);
The array form of this
Reply to discussion (solution)
Print_r ($query);
What are you looking at?
Print_r ($query);
What are you looking at?
Ci_db_mysql_result Object
(
[CONN_ID] = Resource ID #51
[RESULT_ID] = Resource ID #59
[Result_array] = = Array
(
)
[Result_object] = = Array
(
)
[Custom_result_object] = = Array
(
)
[Current_row] = 0
[Num_rows] = 3
[Row_data] =
)
http://blog.csdn.net/cindylu520/article/details/4098360
$rows = Mysql_fetch_assoc ($query);
You can use the mysql_fetch_array (data,array_type) function
Parameters:
data--The result set of the query
ARRAY_TYPE--MYSQL_ASSOC (produces associative array), Mysql_num (produces a numeric array), Mysql_both (default, simultaneously produces associative and numeric arrays)
Remove the array, and the For loop is assembled into a new array form.
CI Framework with Var_dump ($result->result_array ()); Print out associative arrays
Manual Description:
Result_array ()
When the method executes successfully, the recordset is returned as an associative array. Returns an empty array upon failure. In general, we use the following method to iterate through the results, as the code looks like:
$query = $this->db->query ("SQL to execute");
foreach ($query->result_array () as $row)
{
echo $row [' title '];
echo $row [' name '];
echo $row [' body '];
}
$result = Array (), while ($row = Mysql_fetch_assoc ($query)) { $result [] = $row;} Print_r ($result);