Welcome Guest, Not a member yet? Register   Sign In
Simple question get_where() function
#8

[eluser]codelogic[/eluser]
[quote author="deep_sheera" date="1338531854"]there is no problem in column name .... problem is about the variable $column. Try to use

$query = $this->db->get_where(‘news’, array(‘category’ =>'books')); in this i replace $variable with static value 'books' . you can use any other category name instead of book ...try this ....[/quote]

Thanks for the help thus far.

This is what I get when I do that:

Code:
Categories -> 3

3 - 3
Categories -> 2

2 - 2
Categories -> 2

2 - 2
Categories -> 2

2 - 2
Categories -> 2

2 - 2
Categories -> b

b - b





Edit: I changed row_array(); to result_array(); and it works now! Thank you very much!

However, just a little problem, one thing is repeating which I dont want to repeat, and moving it above the foreach(); loop causes an error saying $news_item is undefined. Any ideas? But leaving it in the foreach() returns Categories -> Books repeating.


Code:
Categories -> Books

2 - 2

Categories -> Books

1 - 1


Here is what my view code looks like again


Code:
<?php foreach ($news as $news_item): ?>
  <p>Categories -> &lt;?php echo $news_item['category']; ?&gt;
</p>
<p>
  
</p>
<div class = listing>
&lt;?php echo $news_item['title'] ?&gt;</a> -  &lt;?php echo $news_item['price'] ?&gt;
  </div>
  
  


&lt;?php endforeach ?&gt;


Messages In This Thread
Simple question get_where() function - by El Forum - 05-31-2012, 10:17 PM
Simple question get_where() function - by El Forum - 05-31-2012, 10:35 PM
Simple question get_where() function - by El Forum - 05-31-2012, 10:40 PM
Simple question get_where() function - by El Forum - 05-31-2012, 10:49 PM
Simple question get_where() function - by El Forum - 05-31-2012, 10:51 PM
Simple question get_where() function - by El Forum - 05-31-2012, 11:03 PM
Simple question get_where() function - by El Forum - 05-31-2012, 11:24 PM
Simple question get_where() function - by El Forum - 05-31-2012, 11:27 PM
Simple question get_where() function - by El Forum - 06-01-2012, 12:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB