如果满足声明条件,则无法识别

时间:2014-03-28 16:21:52

标签: php oracle10g

我有一个if语句,其中条件将会话变量与值0进行比较,如果满足,则回显一条消息。如果没有,它会打印一个数据表。问题在于,尽管遇到了这种情况,但并未得到承认。我已经测试过以确保正在设置会话变量的值。它在页面的其他地方使用,绝对有一个值集。任何想法都可能在这里出错?

*编辑:页面开头有一个会话启动功能。

<?php//if number of rows returned is none
        if($_SESSION["CART_NUM"] == 0){
        echo 'YOU HAVE NO ITEMS IN YOUR CART';
        }else{
    //else display cart items
    ?>

        <table id="cart">
            <tbody>
                <tr>
                    <td><h6>ITEM NAME</h6></td>
                    <td><h6>QTY</h6></td>
                    <td><h6>PRICE</h6></td>
                    <td><h6>TOTAL</h6></td>
                    <td><h6>DELETE</h6></td>
                </tr>
<?php
                //query DB again for cart items matching cust id
                $custcart = oci_parse($conn,"SELECT * FROM   
                A113222813_CARTLINE WHERE CUST_ID= :cust_id");
                oci_bind_by_name($custcart, ":cust_id", $_SESSION["CUST_ID"]);
                oci_execute($custcart);

                while ($row = oci_fetch_array($custcart, OCI_ASSOC)) {?>

                <tr class="cartvals">
                    <td><p><?php echo $row['CART_NAME']; ?></p></td>
                    <td><p><?php echo $row['PRICE']; ?></p></td>
                    <!--Form for updating quantity-->
                    <td><form class="updateform" method="post" id="form<?php echo $row['CART_ID'];?>" action="updatecart.php?id=<?php echo $row['CART_ID']; ?>">
                            <input type="text" name="qty" value="<?php echo $row['CART_QTY']; ?>">
                            <a href="javascript:{}" onclick="document.getElementById('form<?php echo $row['CART_ID']; ?>').submit();">submit</a>
                        </form>
                    </td>
                    <td><p><?php echo '&euro;' . ($row['CART_QTY'] * $row['PRICE'])  ?></p></td>
                    <!--Appends cart_id as query string param. Deleteitem.php will get this as an id and delete corresponding row.-->
                    <td><a href="deleteitem.php?item=<?php echo   
                    $row['CART_ID']?>">DELETE</a></td>
                </tr>
<?php
}?>
            </tbody>
        </table>
    </div><!--End Cart Table-->
</div><!--End Main Content-->
<?php

oci_close($conn);
?> 

1 个答案:

答案 0 :(得分:0)

解决:

<?php//if number of rows returned is none行的评论触及了标记。让它重新开始工作。

谢谢你看看吧!