I want to initialize a variable from an entry in an sql table; this entry is one I’ve queried for.
//Grab user id from users.sql
$quser = $db->query("
SELECT *
FROM users //in this table is a column named userident
WHERE username = '$user' //this where conditional filters to a lone row
");*/
I tried $var = $quser["ident"]; since this is how I would display table entries in a foreach() loop, but this doesn’t seem to work.
There is only one ident entry per user, so when I filter the query with where, it results in one row. Why can’t I grab the entry and place in a variable?
This is what you need to do
Here’s an example