doulin6448 2012-10-20 05:26 采纳率: 100%
浏览 14

我无法获得类别ID

Here is the script

$category_id = $cat->ID; /* <-- can get the id */
$getsubs = "SELECT term_id FROM wp_term_taxonomy 
WHERE taxonomy = 'wpsc_product_category' AND parent = '".$category_id."' 
ORDER BY term_id ASC";
$subcats = mysql_query($getsubs);
$num_rows = mysql_num_rows($subcats);
wpsc_start_category_query(array('parent_category_id'=>$category_id, 'show_thumbnails'=> 1)); ?>
<li>
<a href="<?php wpsc_print_category_url();?>" title="<?php wpsc_print_category_name();?>">
<?php wpsc_print_category_image(); ?>
<?php //wpsc_print_category_name();?>
<?php //wpsc_print_category_name();?>
</a>
</li>
<?php wpsc_end_category_query(); ?>
<div style="clear:both;"></div>

Am I using this correctly $cat->ID. Please help.

  • 写回答

1条回答 默认 最新

  • doushi1957 2012-10-20 05:30
    关注

    just try

     parent = '{$category_id}' ORDER 
    

    also use of mysql_* is deprecated so use the pdo or mysqli instead. My personal suggestion is pdo Here is the good tutorial

    评论

报告相同问题?