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

  • SEARCH
  • Home
  • 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 9134977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:45:45+00:00 2026-06-17T08:45:45+00:00

I was wondering if anyone can help me, I am currently working on a

  • 0

I was wondering if anyone can help me, I am currently working on a log in which leads the user to the page so they can play a game. But because there are multiple accounts on the database when the information is sent it displays it for all the accounts on the database not the one user, any ideas on how I can get it to submit the information to one of the users, if this made sense to you??

this is my login section, hope this helps:

<?php

include('connecttest.php');

session_start(); //we're using sessions so this is required!

if($_SESSION['loggedin'] == TRUE) {
header('location: http://html5b.mytestbox.co.uk/sessions/VolumeGame/VolumeGame1.html'); //members area
}else{

if($_POST['submitLogin']) { 
//verify login from user input

$username = mysql_real_escape_string($_POST['username']);
$password = md5(mysql_real_escape_string($_POST['password']));

$select_user = mysql_query("SELECT COUNT(id) AS amount FROM users WHERE username = '$username' AND password = '$password' ");
$user = mysql_fetch_assoc($select_user);
$amount_found = (int)$user['amount']; //amount of users found by the query

if($amount_found > 0) {
$login_attempt = 1; //successful login attempt
$_SESSION['loggedin'] = TRUE;
$_SESSION['username'] = $username;
header('location: http://html5b.mytestbox.co.uk/sessions/VolumeGame/VolumeGame1.html'); //members area
}else{
$login_attempt = 0; //invalid login attempt
}

}

if( ($_POST['submitLogin'] AND isset($login_attempt) AND $login_attempt = 0) OR !$_POST['submitLogin'] ) {

//show login form

if($_POST['submitLogin']) { //attempted to login? (-> invalid login)
echo "<p>Invalid login. </p>";
}

?>

<form method="POST" action="login.php">
<b>Username:</b> <br /> <input type="text" name="username"> <p>
<b>Password:</b> <br /> <input type="password" name="password"> <p>
<input type="submit" name="submitLogin" value="Login!">
</form>

<?php

}

}

?>

This is the code to send the information to the database:

    <?php
    include ("connecttest.php");

    session_start();

    $username = ($_POST['username']);

    $_SESSION['username'] = $username;

    $q1btn=$_POST['q1btnPressed'];
    $q2btn=$_POST['q2btnPressed'];
    $q3btn=$_POST['q3btnPressed'];
    $q4btn=$_POST['q4btnPressed'];


    if ($_POST['q1btnPressed'])
    {
        $sql=" UPDATE users
          SET q1answer = '$q1btn' 
          WHERE username = '$username'" ;
    }
    if ($_POST['q2btnPressed'])
    {
        $sql=" UPDATE users ;
          SET q2answer = '$q2btn'" ;
    }
    if ($_POST['q3btnPressed'])
    {
        $sql=" UPDATE users ;
          SET q3answer = '$q3btn'" ;
    }

          mysql_query($sql)or die (mysql_error);


    mysql_close();  
    ?>

<?php
include "connecttest.php";


$result = mysql_query("SELECT *  FROM users");

$rows=mysql_fetch_row($result);
    echo json_encode($rows);


?>
  • 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-06-17T08:45:47+00:00Added an answer on June 17, 2026 at 8:45 am

    Add a WHERE clause to your query that includes the unique user id.

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

Sidebar

Related Questions

Wondering if anyone can help - I'm sure this was working before, but I
I was wondering if anyone can help me on this cause its driving me
I'm stuck with recursion, was wondering if anyone can help me out with it.
I'm currently implementing some shims for the ES6 draft. I'm wondering if anyone can
Wondering if anyone can help me. I have a site (for the moment )
Wondering if anyone can help me out. How can I line the content area
Wondering if anyone can help me with outputting this to a yaml file? As
I'm wondering if anyone can help me. I have a wcf service running over
Hey guys, I'm wondering if anyone can help me extend this bit of code-
I'm wondering if someone can help me with this. I am currently trying to

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.