Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6151339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:45:21+00:00 2026-05-23T19:45:21+00:00

Thanks for helping with this. I have a script that checks logins and then

  • 0

Thanks for helping with this.

I have a script that checks logins and then sets some cookies. There are 4 cookies that are being set, (later I will probably move some to server session but for now I am using cookies.

The issue that I am having is that only the first 2 of the 4 are being set before the rest of the script is being executed. Can anyone see why?

// If there is a row, and only 1 row, then the details are correct. Set the cookie and re-direct
            $row = mysqli_fetch_array($data);

            setcookie('user_id', $row['User_ID'], time()+ (60*15),"/");
            setcookie('user_name',  $row['UserName'], time()+ (60*15),"/");
            setcookie('access_Level', $row['Access_Level'], time()+ (60*15),"/");
            setcookie('db_con', $row['Db_Con'], time()+ (60*15),"/");

            $home_url = $link . "application/views/Dashboard.php";
            header('Location: ' . $home_url);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:45:22+00:00Added an answer on May 23, 2026 at 7:45 pm

    Using:

    <?php
    
    $row = array(
        'User_ID' => '1',
        'UserName' => '1',
        'Access_Level' => '1',
        'Db_Con' => '1'
    );
    
    setcookie('user_id', $row['User_ID'], time()+ (60*15),"/");
    setcookie('user_name',  $row['UserName'], time()+ (60*15),"/");
    setcookie('access_Level', $row['Access_Level'], time()+ (60*15),"/");
    setcookie('db_con', $row['Db_Con'], time()+ (60*15),"/");
    
    // This will not be set, and the cookie is not created.
    setcookie('db_con2', $row['Db_Con2'], time()+ (60*15),"/");
    
    ?>
    

    http://jfcoder.com/test/setcookie.php

    In Firefox, I check to see the cookies for a page by right-clicking on the page, View Page Info, Security tab, View Cookies button. All four cookies show up on that page in my browser. The last one does not (since it is has no value).

    I’m thinking your column names are not spelled/capitalized correctly, or some other issue, and that $row['Access_Level'] and $row['Db_Con'] are empty columns in your result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks to everyone out there helping newbies like me. So far I have this:
Sorry if this is too simple, but thanks in advance for helping. This is
Thanks for reading this. I am dynamically generating some data which includes a select
Thanks in advance for helping me out (for those who have time and are
Hi i have this script http://jsbin.com/ajaneh , when i make an action throw ajax
I have a zoo with daily data that looks like this: > head(almorol) 1973-10-02
I have been using this simple script to generate images from text: <?php header('Content-type:
Does anyone have some sample code that illustrates how to use Python's Beautiful Soup
I have an SSIS package that runs a script component as one step in
I have some code that needs adjusting. I need the .play rel to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.