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.