Skip to content

Problem with % in parameter value #11

@mawg

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.

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