function get_cats($parent)
{
    global $db_con, $db_con, $mysql_table_prefix, $debug;
    $sql_query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent}";
    $result = $db_con->query($sql_query);
    if ($debug && $db_con->errno) {
        $err_row = __LINE__ - 2;
        printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
        if (__FUNCTION__) {
            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
        } else {
            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
        }
        printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
        printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
        echo "<p> {$sql_query} </p>";
        exit;
    }
    $arr[] = $parent;
    if ($result->num_rows) {
        while ($row = $result->fetch_array(MYSQL_ASSOC)) {
            $id = $row['category_id'];
            $arr = add_arrays($arr, get_cats($id));
        }
    }
    return $arr;
}
function get_cats($parent)
{
    global $db;
    $query = "SELECT * FROM " . TABLE_PREFIX . "categories WHERE parent_num={$parent}";
    $result = $db->query($query);
    echo sql_errorstring(__FILE__, __LINE__);
    $arr[] = $parent;
    while ($row = $result->fetch()) {
        $id = $row[category_id];
        $arr = add_arrays($arr, get_cats($id));
    }
    return $arr;
}
Example #3
0
function get_cats($parent)
{
    global $mysql_table_prefix;
    $query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent}";
    echo mysql_error();
    $result = mysql_query($query);
    $arr[] = $parent;
    while (mysql_num_rows($result) != "" && ($row = mysql_fetch_array($result))) {
        $id = $row[category_id];
        $arr = add_arrays($arr, get_cats($id));
    }
    return $arr;
}
Example #4
0
function get_cats($parent)
{
    global $mysql_table_prefix, $mysqli_conn;
    $query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent}";
    echo mysql_error();
    $result = $mysqli_conn->query($query);
    $arr[] = $parent;
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_array()) {
            $id = $row[category_id];
            $arr = add_arrays($arr, get_cats($id));
        }
    }
    return $arr;
}
Example #5
0
function get_cats($parent)
{
    // global $db, DEBUG;
    $query = "SELECT * FROM " . TABLE_PREFIX . "categories WHERE parent_num={$parent}";
    $result = mysql_query($query);
    if (DEBUG > '0') {
        echo mysql_error();
    }
    $arr[] = $parent;
    if (mysql_num_rows($result) != '') {
        while ($row = mysql_fetch_array($result)) {
            $id = $row[category_id];
            $arr = add_arrays($arr, get_cats($id));
        }
    }
    return $arr;
}