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
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Question about Session destroy

    Does session destroy actualy delete a cookie writen by session? Or does it just stop remembering the ID of the cookie used? If neither, than what does it do.

    This leads into another part. One of my PHP pages writes to a database, the information it pulls out of a session it creates. If you hit refresh however, it writes the information again, in a new database table. How can i stop this? Is session_destroy the answer?
    If I'm postin here, I NEED YOUR HELP!!

  • #2
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes.. why didn't you actually try it before asking?

    or you could check to see if the data was already in the database and not insert it into the tables if data already exists for that session.

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    I tried it. But it still seams to be sending the data.

    if i wrote the session number into the database, and then wrote an if{} to check for it, would that work?
    PHP Code:
    $SESSID session_id();
    mysql_connect(localhost,$username,$password);
    @
    mysql_select_db($database) or die( "Unable to select database");

    $query="SELECT * FROM Orders ORDER BY $SORTBY DESC";
    $result=mysql_query($query);

    $num=mysql_numrows($result);
    mysql_close();
    $i=0;
    while (
    $i $num) {
    $Session=mysql_result($result,$i,"Session");
    if(
    $SESSID == $Session){
    $invalid true;
    }
    }
    if(
    $invalid != true){
    BLAH BLAH BLAH

    Would that do it?

    Also. I know how to create a database table, but im not sure how to add a feild to it. How can i do this?
    If I'm postin here, I NEED YOUR HELP!!

  • #4
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    My teacher at my school does. unfortunatly, i dont have access to it. I have been having him add my feilds when i wanted to add one, but i need to know how to do it with raw code.
    If I'm postin here, I NEED YOUR HELP!!

  • #6
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

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