Welcome Guest, Not a member yet? Register   Sign In
FORMATTING QUESTION - QUERY & MODEL
#6

[eluser]Barwick[/eluser]
[quote author="Aken" date="1352278042"][quote author="Barwick" date="1352264580"][quote author="jprateragg" date="1352263616"]You could just save the result to an array:

Code:
$this->db->select('title, price, number_sites, number_entries, white_label');
$query = $this->db->get('pricing', 3); // limit 3 rows

$data['pricing'] = $query->result_array();
[/quote]

Wouldn't I then need to define each row still though?[/quote]
It depends how you're accessing the data in your views. If you need them in individual, separate parts of your view, then using result() or result_array() might not be very efficient. If you can do a foreach() in your view, then those methods would be more appropriate.[/quote]

I need them in separate parts unfortunately. So I guess I'm stuck with several extra lines of code then. Just don't want to develop bad or incorrect CI habits. Hence odd question like this one. Smile


Messages In This Thread
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-06-2012, 09:20 PM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-06-2012, 09:46 PM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-06-2012, 10:03 PM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-06-2012, 10:37 PM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-07-2012, 01:47 AM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-07-2012, 07:13 AM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-07-2012, 07:41 AM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-07-2012, 07:50 AM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-07-2012, 08:28 AM
FORMATTING QUESTION - QUERY & MODEL - by El Forum - 11-07-2012, 02:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB