Calc where text with character problem

jh

Member
Hi

Im using a calc to select values using a where statement to compare text values. This is working correctly other than when the text values contain characters (like & and '). Ive tried a few attempts to remove these characters from the statment however I can not solve the problem correctly.

Could someone kindly offer some advice?

Kind Regards
 
Hi

Thank you for the reply. I am using:

$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('GROUP_CONCAT(id)')->from('pat_table')->where('pat_name = "{pat_table___pat_name}"');
$myDb->setQuery($myQuery);
return $myDb->loadResult();

so using "{pat_table___pat_name}" as the placeholder value, which is a text field.
This is working OK apart from the issue when the text contains characters (&, ') as mentioned.

Thank you for any help.

Kind Regards
 
You should ALWAYS quote user input because of security reasons. So $myDb-> quote('{....}')
Maybe & etc are Html or Url encoded and you have to decode before.


Gesendet von meinem SM-G930F mit Tapatalk
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top