ram4nd Posted February 15, 2010 Share Posted February 15, 2010 Here is a problem, the value should appear where it's commented, but it doesn't. I can post my model as-well, but i think it's unnecessary. function _categories_for_tutorial_boxes($last_category_id) { static $return, $category, $categories; $category = $this->model->get_category($last_category_id); echo $category->parent_id; //Shows value here while($category->parent_id <= 0) { echo $category->parent_id; //Doesn't show any value here $categories['name'][] = $category->name; $categories['url_name'][] = $category->url_name; $category = $this->model->get_category($category->parent_id); } Quote Link to comment Share on other sites More sharing options...
Thierry Posted February 15, 2010 Share Posted February 15, 2010 Might have to do with it being an integer, printing them won't give a result. Try to adding "". before it and see if it works then. Quote Link to comment Share on other sites More sharing options...
khr2003 Posted February 15, 2010 Share Posted February 15, 2010 on this line: while($category->parent_id <= 0) { are you trying to compare values bigger than zero or less than zero. the statement shows that you want to loop all values less or equal to zero Quote Link to comment Share on other sites More sharing options...
ram4nd Posted February 15, 2010 Author Share Posted February 15, 2010 on this line: while($category->parent_id <= 0) { are you trying to compare values bigger than zero or less than zero. the statement shows that you want to loop all values less or equal to zero I need to rotate until it gets equal with zero Quote Link to comment Share on other sites More sharing options...
ram4nd Posted February 15, 2010 Author Share Posted February 15, 2010 problem solved with do while Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.