Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 21st, 2006, 02:15 PM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default session in shopping cart page

Hi!
I'm doing shopping cart with PHP at the book "Beginning PHP5,Apache and MySQL web development" .

i want to display the number of item that user bought in "cbashop.php"
So, I write the code the same as "cart.php" :

<?php
if (!session_id())
{
session_start();
}
require_once('../Connections/stationery.php');
?>
<?php
        $sessid = session_id();
        $query = "select * from carttemp where carttemp_sess = '$sessid'";
        $results = mysql_query($query) or die(mysql_query());
        $rows = mysql_num_rows($results);
        echo $rows;
    ?>

But in the cbashop.php. It display th error:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\php\html\Products_Pages\products.php:5) in C:\php\html\Products_Pages\cart12.php on line 4

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\php\html\Products_Pages\products.php:5) in C:\php\html\Products_Pages\cart12.php on line 4
0

Can u help me to fix the problem?

By the way, Can U show me some ideas if I create username and password for customer ( create account for customer when they buy product). What I have to do?

Thank U for reading my messege.
  #2 (permalink)  
Old November 22nd, 2006, 01:49 AM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello!
May U help me to fix the problem?
I did the tutorial the same as the book, but it still have a problem at session_start();

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\php\html\Products_Pages\cart.php:3) in C:\php\html\Products_Pages\cart.php on line 14

on the page "getprod.php" when I click in the "View Cart" button. It display the error above.

Please, help me.
Thank U a lot.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Page wise display of data in a shopping cart nazia SQL Server 2000 1 December 22nd, 2006 04:03 PM
Problem with session on Shopping Cart comicghozt .NET Framework 1.x 6 September 21st, 2006 09:22 AM
Session & secuirty issue of shopping cart apple007 ASP.NET 1.0 and 1.1 Basics 0 July 25th, 2006 01:44 AM
can we manage shopping cart without using session pradeep1976 BOOK: Beginning ASP 3.0 0 April 7th, 2005 05:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.