SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Long time no type. I've been working with this DO WHILE loop all morning and can't figure out what I'm doing wrong.

    If you go to:
    http://www.sohh.com/sohhsearch/index.php?categoryID=14

    Right now the breadcrumb trail says:
    home : Bad Boy :

    It should say:
    home : Artists : Bad Boy :

    This is the way my statement reads now:

    do {

    $query_breadcrumbs = "SELECT * FROM tbl_links_categories WHERE linkcategoryID = $get_categoryID";

    echo "<br>$query_breadcrumbs";

    $result_breadcrumbs = mysql_query($query_breadcrumbs);

    check_query($result_breadcrumbs);

    while($row_breadcrumbs = mysql_fetch_array($result_breadcrumbs)) {

    $linkcategoryID = $row_breadcrumbs["linkcategoryID"];

    $linkcategoryname = $row_breadcrumbs["linkcategoryname"];

    $get_categoryID = $row_breadcrumbs["linkcategoryparentID"];

    $breadcrumbs .= "<a href=\"?categoryID=$linkcategoryID\">$linkcategoryname</a> : ";

    echo "<br>Added $linkcategoryname to breadcrumbs.<br>Now get the name of $get_categoryID.";

    }

    }

    while ($get_categoryID == 0);

    Basically, I want it to loop until the $get_categoryID == 0.

    Any suggestions?

    Steve
    <///////~

    www.sohh.com

  2. #2
    SitePoint Addict ibeblunt's Avatar
    Join Date
    Jan 2001
    Location
    Jersey City, NJ
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, I figured it out another way to do it.

    while($get_categoryID > 0) {

    $query_breadcrumbs = "SELECT * FROM tbl_links_categories WHERE linkcategoryID = $get_categoryID";

    echo "<br>$query_breadcrumbs";

    $result_breadcrumbs = mysql_query($query_breadcrumbs);

    check_query($result_breadcrumbs);

    while($row_breadcrumbs = mysql_fetch_array($result_breadcrumbs)) {

    $linkcategoryID = $row_breadcrumbs["linkcategoryID"];

    $linkcategoryname = $row_breadcrumbs["linkcategoryname"];

    $get_categoryID = $row_breadcrumbs["linkcategoryparentID"];

    $breadcrumbs .= "<a href=\"?categoryID=$linkcategoryID\">$linkcategoryname</a> : ";

    echo "<br>Added $linkcategoryname to breadcrumbs.<br>Now get the name of $get_categoryID.";

    }

    }

    However, now it prints out:
    home : Bad Boy : Artists :

    I'd prefer it to print out:
    home : Artists : Bad Boy :
    <///////~

    www.sohh.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •