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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:47:20+00:00 2026-05-11T18:47:20+00:00

my mysqli_fetch_array(mysqi_query($db, $query)) doesn’t appear to be getting the correct information from the database,

  • 0

my mysqli_fetch_array(mysqi_query($db, $query)) doesn’t appear to be getting the correct information from the database, and therefore, the PHP application is not working as it should.

Here are the queries,

<?php
if($_GET){
$current = mysqli_fetch_array(mysqli_query($db, "SELECT * from `tbl_user` WHERE `userid` = '".$_GET['userid']."'"));
$currentperms  = mysqli_fetch_array(mysqli_query($db, "SELECT * from `tbl_perms` WHERE `userid` = '".$_GET['userid']."'"));
} 
?>

Concurrently, the if ($current['userid'] == "1") {echo(" selected ");} isn’t outputting anything at all, so the correct option isn’t selected in the SELECT tag.

So, where: I’d expect:
echo($currentperms[‘newapp’]);
not to equal 1, becuase it is set so in the database, the result of which is “1”. I have test this by echoing the string gained. Newapp is not a column in the table either, so it shouldn’t be returning “1” as a result.

With this:

 if $current['userid'] == "1") {
 echo(" selected ");
 }

Nothing is being echoed, however, the variable has been used in the script earlier, and the output of which is “1”.

Please help me, I’m going through the roof 😐

@sasa: output:
Success!Array ( [0] => 1 [userid] => 1 [1] => shamil.nunhuck [username] => shamil.nunhuck [2] => Shamil Nunhuck [userfullname] => Shamil Nunhuck [3] => shamil.nunhuck@localhost [useremail] => shamil.nunhuck@localhost [4] => 6363d731bd7492fe4c33fc3d90fd61bc [userpassword] => 6363d731bd7492fe4c33fc3d90fd61bc [5] => 1 [userlevel] => 1 [6] => Administrator [usertitle] => Administrator [7] => 1 [tos] => 1 ) Array ( [0] => 1 [userid] => 1 [1] => 0 [ptodo] => 0 [2] => 0 [usercp] => 0 [3] => 0 [pm] => 0 [4] => 0 [bug] => 0 [5] => 0 [abug] => 0 [6] => 0 [admincp] => 0 [7] => 0 [intmgs] => 0 [8] => 0 [adduser] => 0 [9] => 0 [pass] => 0 [10] => 0 [useredit] => 0 [11] => 0 [listuser] => 0 [12] => 0 [newapp] => 0 )

  • 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-11T18:47:20+00:00Added an answer on May 11, 2026 at 6:47 pm

    Try this code:

    //  I put some echo for testing
    if(!empty($_GET['id'])) {
        $id = (int)$_GET['id'];
        $sql = mysqli_query($db, "SELECT * from tbl_user WHERE userid = $id LIMIT 1");
        if(mysqli_affected_rows($db) == 0) {
            echo "There is no user with that id";
        } else {
            $current = mysql_fetch_assoc($sql);
            $currentperms  = mysql_fetch_assoc(mysqli_query($db, "SELECT * from tbl_perms WHERE userid = $id"));
            echo "Success!";
            // Or try to print result
            print_r($current);
            print_r($currentperms);
        }
    } else {
        echo "There is no user id";
    }
    

    OR maybe just a syntax error:

    With this:

     if $current['userid'] == "1") {
     echo(" selected ");
     }
    

    It should be:

    if($current['userid'] == 1) {
        echo(" selected ");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 117k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer USPS provides its own API as long as everything is… May 11, 2026 at 10:49 pm
  • Editorial Team
    Editorial Team added an answer While what you've got isn't necessarily the absolute fastest, it's… May 11, 2026 at 10:49 pm
  • Editorial Team
    Editorial Team added an answer The RemoteUserBackend (from django.contrib.auth.backends) uses special middleware, RemoteUserMiddleware, to access… May 11, 2026 at 10:49 pm

Related Questions

my mysqli_fetch_array(mysqi_query($db, $query)) doesn't appear to be getting the correct information from the database,
I am having a bizare problem where I have a script that works elsewhere
I'm currently displaying a random row from all the entries and that works fine.
EDIT: I got this working now. I have updated the code: I've looked at
I've seen a couple of questions over the last few days that have used

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.