echo result in MySQL query

Hi all,

Hopefully a simple query…

I have the following line which echos the correct result of “1”
[php]<?= $fgmembersite->UserClientid() ?>[/php]

I now need this result in a query in order to echo certain table results, this is the area I am stuck! Any ideas on how to implement?
[php]$query = “SELECT * FROM fms_tbl_projects WHERE client_id= ‘UserClientid()’ ORDER BY client_proj_no DESC”;[/php]

thanks

Notice you have this, $fgmembersite->UserClientid(), that works

Then this, UserClientid(), that doesn’t?

Also, look at prepared statements, they make you database feel safe.

Hi AstoneCipher,

Nope I tired this and it didn’t work, I’ve used a prepared login system called ‘fgmembersite’

thanks for your help

Part of that is because doing this “$s->someMethod()” needs escaping.

“{$s->someMethod()}”

Hi Astonecipher,

Thanks for your input, I figured my problem out. It was a mix up on two columns where the values were swapped so client_id was actually ‘Admin’ instead of being ‘1’.

I’ve corrected the issue and it works using this code;-
[php]’{$_SESSION[‘client_id_of_user’]}’[/php]

Thanks again

Sponsor our Newsletter | Privacy Policy | Terms of Service