I have a string that looks like this:
"count( IF (my_id = 'mykey',value,100)) mykey"
However, the value ‘mykey’ that goes right after my_id is in a variable called $which_value;
I fail to see how I can put the $which_value so that it mantains the single quote around it.
Just add the variable inside your string:
You should, however, escape the value properly or use prepared statements:
Or, using plain ol’
mysql_functions: