PHPCART A session had already been started

Hi,
I doing a cart for a client, that just requeried, that his
cart send by e-mail all products that the users choice in the
catalog. that's works fine...
but I have a session error every new item select, and display
in the cart. any one can help me to fix this?.
I based all with this tuturial..
http://www.adobe.com/devnet/dreamweaver/articles/php_cart.html
The error is this..
Notice: A session had already been started - ignoring
session_start() in D:\www\peachpit\php_cart\db.php on line 41
Warning: Cannot modify header information - headers already
sent by (output started at D:\www\shopcorp\php_cart\db.php:41) in
D:\www\shopcorp\php_cart\db.php on line 42
thanks for any help with this?
this is the code..
<?php
// This page contains the connection routine for the
// database as well as getting the ID of the cart, etc
$dbServer = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "cart";
function ConnectToDb($server, $user, $pass, $database)
// Connect to the database and return
// true/false depending on whether or
// not a connection could be made.
$s = @mysql_connect($server, $user, $pass);
$d = @mysql_select_db($database, $s);
if(!$s || !$d)
return false;
else
return true;
function GetCartId()
// This function will generate an encrypted string and
// will set it as a cookie using set_cookie. This will
// also be used as the cookieId field in the cart table
if(isset($_COOKIE["cartId"]))
return $_COOKIE["cartId"];
else
// There is no cookie set. We will set the cookie
// and return the value of the users session ID
session_start();
setcookie("cartId", session_id(), time() + ((3600 * 24) *
30));
return session_id();
?>

I sorry, I doble click the send button, that is why that
appears doble this post..
Sorry sorry, please some body know about this session
problem?
carolina

Similar Messages

  • Maximum number of sessions has already been reached...

    I have a web application which is made up of a servlet and some jsps. I run a test which puts a load on the webserver which sends multiple requests to the webserver so we can monitor the load.
    The problem is, my application is not handling anything gracefully when the webserver reaches it's max # of sessions. I don't want to change the default 1000 sessions, but I want to direct users to a friendly error page if this situation ever occurs.
    This is the beginning of my doGet method:
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    try {
    java.sql.Date fromDate = null;
    java.sql.Date toDate = null;
    String storySection = null;
    int history = 0;
    int numberOfRecords = 0;;
    HttpSession session = request.getSession(true);
    System.out.println("Checking if session is null***");
    if(session == null) throw new SQLException("SESSION IS NULL!");
    if(request.isRequestedSessionIdValid() == false) throw new SQLException("SESSION NOT VALID!");
    System.out.println("Session passed fine!!!!!!!!!!!!!!");
    This is the output from iPlanet 4.1SP5 errors log file:
    --- (messages before this point were just loading jsp + servlets; i.e. no errors before this point) ---
    [28/Feb/2002:09:44:21] info (21849): Internal Info: loading servlet /mmd/SquawkMessage.jsp
    [28/Feb/2002:09:48:09] warning (21849): SimpleSessionManager: cannot create a new session as the limit on maximum number of sessions has already been reached: (1000)
    [28/Feb/2002:09:48:09] failure (21849): Internal error: exception thrown from the servlet service function (uri=/mmd/SquawkHeadlines.jsp): java.lang.NullPointer
    Exception, Stack: java.lang.NullPointerException
    at jsps.mmd._SquawkHeadlines_jsp._jspService(Compiled Code)
    at org.apache.jasper.runtime.HttpJspBase.service(Compiled Code)
    at javax.servlet.http.HttpServlet.service(Compiled Code)
    at com.netscape.server.http.servlet.NSServletRunner.Service(Compiled Code)
    --- (messages after this point were more of the same until I killed the load test) ---
    Any advice? I need to find out how to handle this problem gracefully.
    Thank you,
    Karen
    [email protected]

    Hi,
    You can have an application variable that increments by one, when each new session is started. That way you can check whether the total no.of sessions have reached 1000, if yes, u can redirect the user to an error page.
    Please get back to me if u still can't get the problem solved.
    SURESH B
    [email protected]

  • HT201209 My wife purchased an iTunes gift card for me and I scratched off the back to get the code and when I entered it to redeem it told me that it had already been redeemed what do I do?

    My wife purchased an iTunes gift card for me and I scratched off the back to get the code and when I entered it to redeem it told me that it had already been redeemed what do I do?

    Try Here  >  http://support.apple.com/kb/TS1292
    If no joy...
    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact
    And there is this...
    http://www.apple.com/hk/en/support/itunes/store/giftcard/

  • Attempted to redeem free upgrade to Mountain Lion today but App store said the code had already been used... though it hadn't

    I was in the process of redeeming my free upgrade to Mountain Lion today, and received a message in the "redeem" section of the App store that the redemption code had already been used. It hadn't been, unless there's a glitch in Apple's system that assigns codes. I accidentally clicked the submit button twice within a few seconds (believing I hadn't clicked it the first time, as nothing on the page indicated that I had submitted the form), as I was attempting to "redeem" my free upgrade.
    Any ideas of what to do would be great. I'm brand new to the Mac world, and am interested in running the most up-to-date OS, especially since I've just procured the very top of the line new Macbook Pro w/Retina display, etc.
    Thanks,

    The App Store has a forum area where experts await with answers:
    https://discussions.apple.com/community/mac_app_store

  • While using my pad it suddenly stopped and stated that I neede to activate it. Now it wont activate even though it had already been activated. What do I do?

    while using my pad it suddenly stopped and stated that I neede to activate it. Now it wont activate even though it had already been activated. What do I do?

    Everytime I try to do an activation it later tells me that it could not activate because the activation server is temporarily unavailable. I ready to throw it.

  • Everytime i try to sync my ipod an error screen comes up and says the sync session had failed to start?

    Everytime i try to sync my ipod an error screen comes up and says the sync session had failed to start? Why and what can i do to fix it.

    If you are using a Windows based computer to sync your iPod try restarting the AMDS...
    iPhone, iPad, iPod touch: How to restart the Apple Mobile Device Service (AMDS) on Windows

  • My redemption code had already been used. Where do i get a new one?

    Hi,
    I was trying to download the creative adobe on my macbook.
    I made a mistake and had to refresh the page but i already used my redemption code.
    Now it says my code had already been used and i can't use it again which means i can't download the adobe pack...
    Now what??

    Hello,
    best would be in my eyes you contact Adobe here Contact Customer Care and click throug the headlines. If necessary and for further questions use the chat, I had the best experiences. I quote from Adobe's employee Preran: The chat button is activated as soon as there is an agent available to help.
    In addition two links
    http://helpx.adobe.com/contact.html?step=CCSN_adobe-id-signing-in and
    http://helpx.adobe.com/creative-cloud/kb/unable-login-creative-cloud-248.html
    They to end in the question "Still need help? Contact us." (See above)
    Good luck!
    Hans-Günter

  • Response had already been committed

    hello,
    i have a struts application which saves a file to databse as BLOB. on click of alink this file has to be read from database and opened in browser. i do this by first reading from blob and write it to a file and then read it from the file and write to the response. i am able to read this file from databse and write it to a file on the physical drive. but i am not able to write the file in response so that it goes to browser.
    i get the following error.
    : java.lang.IllegalStateException: Response has already been committed.
    the code snippet to write to response is as follows.
    response.setContentType(oscDVO.getM_strContentType());
    response.setHeader("Content-Disposition","attachment;filename=\"" + oscDVO.getM_strFileName()+"\"");
    ServletOutputStream outputStream = response.getOutputStream();
    File file = new File("C:\\"+oscDVO.getM_strFileName());     FileInputStream fileInputStream = null;
    fileInputStream = new FileInputStream(file);
    BufferedInputStream bis=new BufferedInputStream(fileInputStream);
    int nByte = bis.read();
    boolean b=false;
    while(nByte != -1)
    outputStream.write(nByte);
    nByte = bis.read();
    i am in urgent need of solution. i hv searched on most of the forums but hv not got any solution. if anyone has ever implemented similar knd of functionality pls help.
    thanking in advance.

    thnkou for ur quick response.
    i tried closing the streams as well.
    but the problem persists.
    if i try to open a word document, the document opens properly, the same error of response committed ocurs but i think ms word truncates tthe error. but if i open the same doc file in any other editor, the error is displayed at the bottom of the correct data.
    but with very small text files of less than1 kb also , i get this error.

  • I have an iphone 5 with iOS 6.  I just  tried to sync it with my itunes account to put new music on my phone and it gave me a message that said the iphone could not be synced b/c "the sync session had failed to start".  How do I fix this?

    I have an iphone 5 with ios 6.1.4.  I just tried to sync my phone to my itunes acct to load new music onto my phone and it gave me a message saying that it was unable to sync b/c "the sync session failed to start".  It let me download all pictures, but would not let me do anything else and just kept repeating the same message.  Why is this happening and how do I fix it?

    You need to subscribe to iTunes Match to store your music on iCloud:
    http://www.apple.com/itunes/itunes-match/
    To transfer iTunes Store purchases made on your phone to your computer, connect your phone then choose "Transfer purchases..." from the File menu in iTunes.
    Photostream transfers photos taken on your iOS devices to other devices and your computer. For troubleshooting Photostream see: http://support.apple.com/kb/TS3989

  • Hey What's Up With THIS!    I attempted to disconnect from iCloud from my Mac Book Pro the system said I'd loose anything on my computer which had already been uploaded to the iCloud.    When I did the same with my iPhone a message came up asking me IF I

    Hey! What's Up With THIS!?
    I've been working on a Keynote Presentation for some time now.
    Once I added the iCloud.
    The system kep going into Storage Mode every 3-4 click on the keyboard or mouse.
    So I decided to shut the iCloud down from my computer.
    Oh Yeah... Here's the FUN Part.
    The system stated 'IF I did..... Everything loaded into theiCloud would be removed from my computer
    (MacBook Pro).
    So soon after (I obviously didn't disconnect the iCloud, can't afford to losse 'who knows what')
    So soon after I went into my iPhone to turn it off as well...
    There I received the message/question "Do you want items left on your iPhone?"
    Huh!     I didn't even receive that option on the Mac.

    Sweet!   Thank You Very Much!
    You should be a Tech!
    You explained it as simple as any Apple Tech I've spoken to.
    I'm in Alaska.
    We just received our first Apple Store 2 months ago.
    During their third week of operation, I mistakenly walked in assuming it was a
    contract Apple store (I heard a New branch/store of an Apple sub had opened a new store in
    Anchorage).  Needless to say, I bet I took 15 -20 classes in that week. Tuesday through Monday.
    Yep! I cancelled everything and just nailed everyone I could.
    I live near Fairbanks approximately 7+ hrs away.
    I had never had any instruction on Apple/Mac since becoming a PC convert just before Christmas of 2008.
    The Crew of Trainers Apple brought in, and New one's still in training are Exceptional!
    I've been like a five year old with a Ferrari until these Awesome Folks and Kids trained me in at
    That Apple Store.    They even assisted me in tweeking a Keynote Presentation prior to going into a 6 day
    Engineering Show also in Anchorage three weeks ago.

  • Add photos to a photobook that has already been started.

    I have already started my photo book from photos I put together in an album. The problem is I for got a few photos I want to use and now I can't figure out how to add them. I added them to the album I am using for the book, they show up there, but when I open the book, only the original photos are there, not the ones I added.
    Help

    If I understand your post correctly, you added the photos to the album after you opened a book project of that album. All this does is add photos to just the album; the changes are not duplicated in the book. To add photos to a book once it is already started, drag the photos you want to add to the icon for your book. They should appear in the browser. You are then able to add these photos to your book.
    Good luck.

  • I am unable to see most of Dailybooth after a pop-up appeared too quickly for me to read, as I had already been pressing a button that exited out of it.

    I was browsing the site, and something popped up at the top of the browser underneath the tabs, but I didn't catch what it had said. Immediately after, the site began to lose the ability to show all the pictures that had been posted, and the whole site looked emptier.

    It is possible that you clicked "Block Images" in the right click context menu while trying to save an image.
    *You can see the permissions for the domain in the current tab in Tools > Page Info > Permissions
    *You can see all exceptions in Tools > Options > Content: Load Images > Exceptions
    See:
    * http://kb.mozillazine.org/Images_or_animations_do_not_load
    *A way to see which images are blocked is to click the favicon ([[Site Identity Button]]) on the left end of the location bar.
    *A click on the "More Information" button will open the Security tab of the "Page Info" window (also accessible via "Tools > Page Info").
    *Go to the <i>Media</i> tab of the "Tools > Page Info" window.
    *Select the first image link and scroll down though the list with the Down arrow key.
    *If an image in the list is grayed and there is a check-mark in the box "<i>Block Images from...</i>" then remove that mark to unblock the images from that domain.

  • TS1559 wifi still unable to turn ON, still grayed. all 5 steps had already been done

    refer to article TS1559.
    all suggested resolution has been followed, but did not resolved my issue. my wifi is still grayed and could not be ON.
    any other advise please

    the main discussion regarding this issue: https://discussions.apple.com/thread/4310121

  • I downloaded a new album on my iphone 4 and when backed it up on my itunes it cannot be found. I Checked in the store for available downloads, it is there either. Tried to buy it again and it stated it had already been purchased. Please help me find it.

    Please help me find it.Thanks

    No iTunes content on the iPhone is included with the iPhone's backup.
    If you are syncing music and video - you have Sync Music selected under the Music tab for your iPhone sync preferences with iTunes, after purchasing any music direct with your iPhone the music should be copied to your iTunes library automatically the first time you sync your iPhone with iTunes after doing so. Under Store in the iTunes source list, a playlist should be created automatically as well with the name - Purchases On - the name of your iPhone.
    Not so if you are manually managing music and video with your iPhone. When manually managing music and video with your iPhone, it is manual all the way in both directions. After purchasing music direct with your iPhone, with your iPhone connected at the iTunes menu bar go to File and select Transfer Purchases From - the name of your iPhone.

  • I purchased a song with $1.08 on my account. After a second iTunes told me that I had insufficient funds to purchase a $0.99 song. But the money had already been removed. Now i'm stuck with $0.04 left. Can Somebody explain why iTunes just stole from me?

    I just wanted to buy some Owl City! Can I please get some answers? I feel robbed...

    Then Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

Maybe you are looking for

  • More than one line on bar chart

    I am creating a Line chart from a table.  The table includes a code column, date column, and several statistic columns. The dates are end of month dates only. There are about 10 different codes for each month.  The statisic columns are the totals for

  • Impdp error

    Hi, Db :10.2 While importing we got the below error. impdp directory=dump full=y dumpfile=28may2013.dmp logfile=devmar28may2013_import.log ORA-39126: Worker unexpected fatal error in KUPW$WORKER.LOAD_METADATA [TABLE_DATA:"SYS"."SYS_IMPORT_FULL_02"] S

  • No puedo instalar itunes 10.5.2 se queda pasmada la pantalla en actualizando libreria de musica

    actualize a la ultima version y ahora no puedo abrir itunes porque se queda en actualizando la biblioteca y no responde itunes

  • Income recognition based on revised planned revenue

    Hi, I am facing a critical issue on PS Results Analysis and I though you can only help me, because you  have worked extensively on CO side. The client is using POC based Results Analysis and using ''Planned Revenue'' as basis of Income recognition in

  • Putting frontpanels of sub-Vi's togeter on one Vi front panel

    Hi guys, How to put the frontpanels of my sub-Vi's to one Vi frontpanel? So they are collected at one panel.