1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <?php
include("/Connections/connexion.php");
if (empty($category)) {
$category=1;
}
$childval = $category;
//$catline[]="";
$query = "select categoryid, name from category where categoryid=\"".$childval."\"";
$result = mysql_query($query);
if ($row=mysql_fetch_array($result)) {
$catid[1]= $row["categoryid"];
$catname[1]=$row["name"];
}
while (!($childval==0)) {
$query = "select parentcategoryid from category where categoryid=\"".$childval."\"";
$result = mysql_query($query);
if ($row=mysql_fetch_array($result)) {
$childval = $row["parentcategoryid"];
$query = "select categoryid, name from category where categoryid=\"".$childval."\"";
$result = mysql_query($query);
if ($row=mysql_fetch_array($result)) {
$catid[1]= $row["categoryid"];
$catname[1]=$row["name"];
}
}
} |
Partager