Jump to content

Search the Community

Showing results for tags 'sessionid'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi, how would I make it so that my page returns and echos database information? I've used the mysqli method in most of my coding, examples below and basically I want it so that it querys the firstname and lastname to the correct session id. I managed to do something like this before by doing a $row search but the problem with that was that it was returning all of the first and lastnames not one that matches the id to the database. I know you can do $row searches but I'm not too sure on those and the ones that were shown are not safe as it displays things like the database name, database password ect in that document where I've done an include like > include 'dbConfig.php'; (Also please note even though it hasn't got any includes, that's because the pages themselves are includes and all the includes that are needed such as the database one, I've declared on previous pages.) How I would like it to work: <?php Do some kind of safe row search up here. if(<USERS ID IS VALID THEN DO THIS>) { Echo the firstname and lastname here. } ?> How I've tried to do it: <?php if ($stmt = $mysqli->prepare("SELECT id, firstname, lastname FROM users WHERE firstname = ? AND lastname = ? LIMIT 1")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($user_id, $firstname, $lastname); $stmt->fetch(); if($stmt->num_rows == 1) { $_SESSION['user_id'] = $user_id; $_SESSION['firstname'] = $firstname; $_SESSION['lastname'] = $lastname; echo $firstname; echo $lastname; return true; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.