Get Categorie Path from Categorie
pvdb20 <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.devel |
|---|---|
| Message-ID | <6a797a6d9aaf08437ae19f4ba70b97bb@osCommerce-Forums> |
This message was sent from: Development
http://forums.oscommerce.com/viewtopic.php?p=153351#153351
----------------------------------------------------------------
Hi,
i habe change the function tep_get_parent_categories of the gernal.php, so that it runs independent, from the Shop functions.
This is my function:
function get_categories(&$categories, $categories_id)
{
$parent_categories_query = mysql_db_query($db_name, "select parent_id from categories where categories_id = '$categories_id'");
while ($parent_categories = mysql_fetch_array($parent_categories_query))
{
if ($parent_categories[parent_id] == 0)
return true;
$categories[sizeof($categories)] = $parent_categories[parent_id];
if ($parent_categories[parent_id] != $categories_id)
{
get_categories($categories, $parent_categories[parent_id]);
}
}
}
I call it like this:
$categories_id = 39;
$categories = array();
get_categories(&$categories, $categories_id);
I get following error Message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wampp13cs\htdocs\preiswerte-druckertinte\functions.php4 on line 10
Line 10 is the line with the while loop.
Can anybody find an error or tell me what to change that my function will work?
Philipp