Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: shopping cart

  1. #1
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    shopping cart

    ive created my shopping cart but when running it this is what shows up

    Parse error: syntax error, unexpected T_INCLUDE in G:\webclient\xampp\htdocs\web\index.php on line 2

    this is the code below


    <? php
    include('book_sc_fns.php');
    // the shopping card needs sessions, sostartone
    start session();
    do_html_header('Welcome to Media-O-RAMA');

    echo'<p>Please choose a category:</p>';

    //get categories out of the database
    $cat_array = get_categories();

    // display links to category();
    display_categories($cart_array);

    //if logged in as admin, show add,delete, edit cat links
    if (isset($HTTP_SESSION_VARS['admin_user']))
    {
    display_button('admin.php', 'admin-menu', 'Admin Menu');
    }
    do_html_footer();
    ?>

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,402
    Thanks
    11
    Thanked 298 Times in 297 Posts
    A couple things look odd...<?php should have no space between the ? and the php. Also your "start session" should be "session_start".

    Dave

  • #3
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error mesages

    <?php
    include('book_sc_fns.php');
    // the shopping card needs sessions, so start one
    session_start();
    do_html_header('Welcome to Media-O-RAMA');

    echo'<p>Please choose a category:</p>';

    //get categories out of the database
    $cat_array = get_categories();

    // display links to category();
    display_categories($cart_array);

    //if logged in as admin, show add,delete, edit cat links
    if (isset($HTTP_SESSION_VARS['admin_user']))
    {
    display_button('admin.php', 'admin-menu', 'Admin Menu');
    }
    do_html_footer();
    ?>

    i changed it and its now giving me a lot of errors


    Warning: include_once(db_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 3

    Warning: include_once() [function.include]: Failed opening 'db_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 3

    Warning: include_once(data_valid_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 4

    Warning: include_once() [function.include]: Failed opening 'data_valid_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 4

    Warning: include_once(output_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 5

    Warning: include_once() [function.include]: Failed opening 'output_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 5

    Warning: include_once(book_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 6

    Warning: include_once() [function.include]: Failed opening 'book_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 6

    Warning: include_once(user_auth_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 7

    Warning: include_once() [function.include]: Failed opening 'user_auth_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 7

    Warning: include_once(admin_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 8

    Warning: include_once() [function.include]: Failed opening 'admin_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 8

    Warning: include_once(order_fns.php) [function.include-once]: failed to open stream: No such file or directory in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 9

    Warning: include_once() [function.include]: Failed opening 'order_fns.php' for inclusion (include_path='.;G:\webclient\xampp\php\PEAR') in G:\webclient\xampp\htdocs\web\book_sc_fns.php on line 9

    Fatal error: Call to undefined function do_html_header() in G:\webclient\xampp\htdocs\web\index.php on line 5

  • #4
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,402
    Thanks
    11
    Thanked 298 Times in 297 Posts
    I have a feeling book_sc_fns.php is trying to include a few things that aren't there. Have you looked at it?

    Dave

  • #5
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    file

    <?php

    include_once('db_fns.php');
    include_once('output_fns.php');
    include_once('book_fns.php');
    include_once('user_auth_fns.php');
    include_once('admin_fns.php');
    include_once('order_fns.php');

    ?>

    thats book_sc_fns.php

    and
    <?php

    function db_connect()
    {
    $result = mysql_connect("localhost", "bookorama", "bookorama123");
    mysql_select_db("booksr");
    if (!$result)
    return false;
    return $result;
    }

    function db_result_to_array($result)
    {
    $res_array = array();

    for ($count=0; $row = $result->fetch_assoc(); $count++)
    $res_array[$count] = $row;

    return $res_array;
    }

    ?>
    db_fns.php

  • #6
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,402
    Thanks
    11
    Thanked 298 Times in 297 Posts
    So are all these files in the same directory on the server as book_sc_fns.php? Your errors are saying it can't find them.

    Dave


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •