php - Query works if I don't bind, but fails when I do. Where is my error? -
i have tried variations of this:
$prep_get_company=$connection->prepare("select * sl_customer company_name = ':company_name'"); $prep_get_company->bindparam(':company_name',$company_name);
and no results if this:
$prep_get_company=$connection->prepare("select * sl_customer company_name = '$company_name'");
it returns desired results. contents of $company_name
string spaces.
remove single quotes on query:
select * sl_customer company_name = ':company_name'
should have been:
select * sl_customer company_name = :company_name
the single quote treat literal value make prepared statement fail bind think there nothing bind when using single quotes.
the prepared statement arrange data you're binding needed.
Comments
Post a Comment