I have a database setup for authorisation to a website, using PHP i can get the response below
Name / Group1 / Group2 / Group3
Me / Y / N / Y
Query I am using is :-
Select [Group2] from Table where Name = 'Me'
but this is returning
Array
(
[0] => Array
(
[group2] => Y
)
)
I am looking for it to just return Y
DatabasesPHPSQL
Last Comment
ste5an
8/22/2022 - Mon
ste5an
hmm, it depends on how you query your database and what framework (methods) you use. Using query/fetch returns a row set, thus the arrays. When you need a scalar you need to return the column:
e.g. something like
$query = $connection->query("Select [Group2] from Table where Name = 'Me'");$rowset = $query->fetch();$scalar = $rowset["Group2"];
Sorry i a bit at a loss how to add it in. This is the full code that i am using that returns the before mentioned array but needs to bring back just a Y to the String $checkaccess
e.g. something like
Open in new window