使用mysql内连接有三个表,无法在php输出中显示结果

时间:2015-07-10 21:01:12

标签: php mysql sql

我正在加入三个表,我将每个列名称与表格作为前缀,因此每个列名称都是不同的。查询给了我想要的MySQL结果,但当我试图在php中回显它的特定字段名称时,它们不会显示。我尝试了mysqli_fetch_arrary()mysqli_fetch_assoc()

<?php
$query  = "SELECT * ";
$query .= "FROM plans ";
$query .= "INNER JOIN plans_items ON plans.plan_id = plans_items.fk_plan_id  ";
$query .= "INNER JOIN items ON plans_items.fk_item_id = items.item_id ";
                    $item_set = mysqli_query($connection, $query);
                    confirm_query($item_set);
?>
<ul class="pages">
<?php 
    while($single_item = mysqli_fetch_array($item_set)) {
?>
    <li><?php echo "Name :" .$row['item_name']. "."; ?></li>
<?php
    }
?>
<?php mysqli_free_result($item_set); ?>
</ul>

0 个答案:

没有答案