Jump to content

[SOLVED] Using a "variable combination" within an SQL statement


mrherman

Recommended Posts

Hello again, friends....

 

I have a function that requires one parameter: an "m" or an "r".

 

If the parameter is an "m", I want to access the db field "mtotcor."

If the parameter is an "r", I want to access the db field "rtotcor."

 

The following throws an error:

 

$sql = "SELECT $param . totcor FROM..."

 

How can I take the passed $param and combine it with "totcor" to make "mtotcor" or "rtotcor" that can be used in the SQL SELECT statement?

 

Thank ya!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.