Jump to content

Problem with While loop.


ram4nd

Recommended Posts

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);
	}

Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.