Skip to content

Problem with % in parameter value #11

Description

@mawg

Probably not a problem with the code (which I have been using for years and find to be excellent! Thank you!), but with my use of it.

My code

$sqlText = 'SELECT count(*) AS count FROM recruiters WHERE recruiter_email LIKE "%:agencyEmailDomain"';
    
$sqlParameters =  array('agencyEmailDomain' => $agencyEmailDomain);

where $agencyEmailDomain == "gmail.com"

and $expandedSqlCommand = PdoDebugger::show($sqlText, $parameters);

expanded to

SELECT count(*) AS count FROM recruiters WHERE recruiter_email LIKE "%'Gmail.com'"

Notice those single quotes around the domain name?

Is there something that I can do, like escaping the % sign?

Thanks in advance for your help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions