#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    30
    Rep Power
    0

    Error on line of code


    hello guys,

    y am i having an error on this line of code
    PHP Code:
    <?php
    $cartItemCount 
    count($_SESSION['cart']);
    ?>
    do i need to define the 'cart'?

    how i do it if need be?

    please

    full code is like this

    PHP Code:

    <?php
    $cartItemCount 
    count($_SESSION['cart']);
    ?>
    <div class='navigation'>
        <a href='index.php' class='customButton'>Home</a>
        <a href='Products.php' class='customButton'>View Products</a>
        <a href='Cart.php' class='customButton'>View Cart <?php echo "({$cartItemCount})"?></a>
    </div>
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    will you ever learn that "I got an error" is no useful problem description?

    You know, there are a lot of different errors that can occur when running an application. The parser may choke on the syntax, there may be a runtime error, the output may be wrong, the program may run into an infinite loop, your whole PC may crash and so on.

    We cannot help you unless you tell us the concrete error.

    Maybe your "error" has to to with the fact that you don't start the session anywhere. But it might as well be something else. I don't know.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,556
    Rep Power
    2338
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    30
    Rep Power
    0
    i found the error just had to define the array

    thnx

IMN logo majestic logo threadwatch logo seochat tools logo