Is it possible to output the result of an SQL query in a single line or variable? (I'm bad in php and mysql) Let's say I have db "agents" with columns - agent_id, agent_fname, agent_lname, agent_dept.
Using this query:
$sql = SELECT a.`agent_fname` FROM agents a WHERE a.`agent_dept` = 'FCA'
I want to get a string or variable, so I can use it anywhere in my php file (i.e. $ my_variable, which prints the result of my query). Is it possible? If so, how?
Thanks!
* I have a few lines.
Pinocchio
source
share