Happy new year to all,

I been working on my ecommerce system over the break and added my breadcrumb navigation, i'm now looking for ways to reduce the size of the code in this script, could anyone offer and advice or ways to reduce this code:

Code:
// Breadcrumb Navigation
$breadcrumbnav = "> ".$category_name." ";

for ($x = 1; $x < 10; $x++) {
  // If $x is odd, break out
  $bread_id = $category_id;
  if ($parent_id != "") {
    $bread_id = $parent_id;
  }
  $sql = "SELECT parent_id FROM ".$siteid."_categories WHERE category_id='$bread_id'";
  $query = mysql_query($sql, $dbConn);
  $row = mysql_fetch_array($query, MYSQL_ASSOC);
  $parent_id = $row['parent_id'];
  if ($parent_id == 0) {
    break;
  } else {
    $sql = "SELECT category_name FROM ".$siteid."_categories WHERE category_id='$parent_id'";
	$query = mysql_query($sql, $dbConn);
	$row = mysql_fetch_array($query, MYSQL_ASSOC);
    $cat_name = $row['category_name'];
    $breadcrumbnav = "> <a href='catalog.php?a=".$parent_id."'>".$cat_name."</a> ".$breadcrumbnav." ";
  }
}
It is different to ways i seen breadcrumbs done before, but i have decided my database to look up products and categories in a different way to normal.

Thank you in advance for any help.