0

我正在尝试从与类别表相关的表中回显数据,但我没有得到它来显示数据,这是错误的。

这是一些代码:

tbl_category_news
- id_category_news
- 类别

tbl_news
- id_news
- id_category_news
-title
-description
-msg
-name_arquive
-legend

 <?php
     $categoryId = 1; 
      $sql_visualizar = mysql_query("SELECT * FROM tbl_news AS t1 JOIN tbl_category_news c
    ON c.id_category_news=t1.id_category_news WHERE id_category_news = {$categoryId}");
    while($linha = mysql_fetch_array($sql_visualizar)){
    $title = $linha ['title'];
    $description = $linha['description'];
    $msg = $linha['msg'];
    $legend = $linha['legend'];
    $nome_arquive = $linha['name_arquive'];
    $id_news = $linha['id_news'];

      ?>
<?php echo $msg?>
<?php
  }
  ?>
4

1 回答 1

0

换个试试WHERE id_category_news = {$categoryId} with WHERE t1.id_category_news = $categoryId

于 2012-06-21T14:30:37.317 回答