11-24-2016, 09:03 PM
$query=$db->query("Select * from users where id = ?", array($uid));
Then since you are only expecting one result you do
$results = $query->first();
The deal with the question marks in the queries is a security feature that forces it to only look in that one column for the information and stops people from doing some hackery type things.
If your query was expecting multiple results then you would switch out the word first for results.
If you are searching for multiple things you just put a? After each one and then put a comma between every variable in the array
Then since you are only expecting one result you do
$results = $query->first();
The deal with the question marks in the queries is a security feature that forces it to only look in that one column for the information and stops people from doing some hackery type things.
If your query was expecting multiple results then you would switch out the word first for results.
If you are searching for multiple things you just put a? After each one and then put a comma between every variable in the array