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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:11:23+00:00 2026-06-12T08:11:23+00:00

Hi all. I’m currently in the middle of developing a login class that handles

  • 0

Hi all. I’m currently in the middle of developing a login class that handles the user login. I get my array list back from the DB by creating it as an object with the following code:

 $dBquery = new Selection();
 $dBquery->setUpSelection($sqlConstructor);
 $sqllogin = $dBquery->sQLResults();
 print_r($sqllogin);

and from the print_r, this is what’s returning:

Array (
    [0] => Array (
        [0] => 1
        [uSID] => 1
        [1] => 0
        [level] => 0
        [2] => a
        [Username] => > a
        [3] => a
        [password] => a
        [4] => a
        [email] => a
        [5] => 0
        [lockedID] => 0
    )
)

Now, from the looks of it, it’s an array with in an array, which is a bit confusing since the code to create this array doesn’t instigate that (I could be wrong, this is unfortunately where I need pointers). The code that sets up the array is:

private function selectAndQuery() {
        //Select query with AND
        $sql2 ="SELECT * FROM ".$this->table." WHERE ".$this->column."='".$this->where."' AND ".$this->andColumn."='".$this->sqlAnd."'  ";
        $a = mysql_query($sql2) or die(mysql_error());      
        //get number of rows to determine if there are any results
        if (mysql_num_rows($a) < 1) {
                    //TO DO no results returned.
            $this->sQLResults();
        } else {
            //if there's a result store it into an array.
            while ($row = mysql_fetch_array($a)) {
            $this->sqlResultsArray[] = $row; 
            }           
            $this->sQLResults();
        }
    }

So my question to you guys is, what’s causing the array to go dimensional and what can I do to stop it? I know I could just pull the information from the multi-dimensional array but I was trying to keep things as simple as possible.

Any help would be much appreciated.
Many thanks.

  • 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-12T08:11:24+00:00Added an answer on June 12, 2026 at 8:11 am
    $this->sqlResultsArray[] = $row; //This is causing you to get multidimensional array
    since  mysql_fetch_array returns an array.So if you are sure that you will get only one
    row.you can use below given mehod instead
    if(mysql_num_rows() = 1){$this->sqlResultsArray  = mysql_fetch_array($a);}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, How can I bind the array of drop down list items returned from
All- I am trying to get the user's current location than display that on
all is said in the title, I want to get from an element all
All, I'm a beginner user of Eclipse. I am currently using it for a
All, If I run a query like the following: $qry = Select wrong_column from
All I want to do is return the index of the i that is
all. We're trying to get some intersect collisions working, but the problem experience is
All, I have the following class structure public class Foo : IComparable<Foo> { public
All, I have a SQL Database class structure like public class Database : ISqlObject,
All, I have a stored procedure on SQL Server 2005 that accepts an XML

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.