CI ing (loading) data to the view layer method, ciview. CI ing (loading) data to the view layer. ciview this article describes how to map (load) data to the view layer. For your reference, the CI has a disgusting CI ing (loading) method to the view layer. ciview
This article describes how to map (load) data from CI to the view layer. We will share this with you for your reference. The details are as follows:
CI has a disgusting thing, that is, it needs to put all the data into the $ data array to map to the view layer, such:
Currently, the link table (link table, field: id name url) in the database is searched for as follows:
$ Query = $ this-> db-> query ("select id, name, url from cg_link where 1"); $ links = $ query-> result (); // $ links cannot be directly transmitted to the view layer. comparison of errors // transmission of errors (ing mode): // $ this-> load-> view ('link', $ links); // correct transmission (ing mode): $ data ['link'] = $ links; $ this-> load-> view ('link', $ data );
Therefore, as long as the data is transmitted, it must be put into $ data. to query a data or one-dimensional array, use the following function:
$ SQL = "select id, name, url from cg_link where id = 21 limit 1"; $ query = $ this-> db-> query ($ SQL ); $ one = $ query-> row (); // Here is a piece of data, obtaining method, $ one-> name;