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 6751429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:55:35+00:00 2026-05-26T12:55:35+00:00

this is some of my script so far: $check = (SELECT username FROM users

  • 0

this is some of my script so far:

$check = ("SELECT username FROM users WHERE username = '$us3r'");
$check2 = ("SELECT password FROM users WHERE username = '$us3r'");
$check3 = ("SELECT userID FROM users WHERE username = '$us3r'");
$check4 = ("SELECT userrole FROM users WHERE username = '$us3r'");

//Role

$role = mysql_query($check4);
$arr5 = mysql_fetch_row($role);
$roles = ($arr5[0]);

echo $roles;

if($roles = 1) {

    //Username

    $results3 = mysql_query($check);
    $arr2 = mysql_fetch_row($results3);
    $results4 = ($arr2[0]);

    //Password

    $results5 = mysql_query($check2);
    $arr3 = mysql_fetch_row($results5);
    $results6 = ($arr3[0]);

    //UID

    $id1 = mysql_query($check3);
    $arr4 = mysql_fetch_row($id1);
    $id = ($arr4[0]);

    echo 1;

}

else if($roles = 2) {

    //Username

    $mresults3 = mysql_query($check);
    $marr2 = mysql_fetch_row($mresults3);
    $mresults4 = ($marr2[0]);

    //Password

    $mresults5 = mysql_query($check2);
    $marr3 = mysql_fetch_row($mresults5);
    $mresults6 = ($arr3[0]);

    //UID

    $mid1 = mysql_query($check3);
    $marr4 = mysql_fetch_row($mid1);
    $mid = ($marr4[0]);

    echo 2;

};

However there is something wrong with my if / else if for some reason the echo shows 21 when I use a user with a userrole of 2, I want it to be either 11 or 22 :/

  • 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-26T12:55:35+00:00Added an answer on May 26, 2026 at 12:55 pm

    You need to use == for comparison instead of =:
    Change

    if($roles = 1)
    

    to

    if($roles == 1)
    

    and

    else if($roles = 2)
    

    to

    else if($roles == 2)
    

    If you use assignment (=) instead of comparison (==) it will not only evaluate to true, but it also will change the variable.

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

Sidebar

Related Questions

I have been working on this for some time. The script does work and
<?php // Execute a shell script $dump = shell_exec('bigfile.sh'); // This script takes some
For some reason This php script won't echo anything: <?php setcookie(pop,'hi',time()+604800); echo $HTTP_COOKIE_VARS['pop']; ?>
For some reason I can't get this script to run when I add the
I have this script which simply kills an app KEY_NAME=/some/path kill `ps -ef |
I have this content script that downloads some binary data using XHR, which is
I have some questions about the performance of this simple python script: import sys,
well i run this script , which is written to do some screenshots of
well i run this script , which is written to do some screenshots of
Let's imagine I have a bash script, where I call this: bash -c some_command

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.