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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -