List:Connector/C++« Previous MessageNext Message »
From:Cifer Lee Date:March 1 2013 1:29pm
Subject:can't use where `id` like '%?%' in prepared statment ?
View as plain text  
hello everyone, I have read in mysql reference manual that

"The markers are legal only in certain places in SQL statements. For
example, they are permitted in
the VALUES() list of an INSERT statement (to specify column values for a
row), or in a comparison
with a column in a WHERE clause to specify a comparison value. "

but it seems that I can't write like below, because it queries no data.

char *origin = "select `id`, `name` from a_table where `id` like '%?%'
and  `name` like  '%?%' ";

mysql_stmt_prepare(stmt, origin);     // stmt have been defined as
MYSQL_STMT

and surely I have done the binding work and so on...........

but I am not understand, the ref man says that I can put the marker(?) in
where clause, but why I get no data?

Thread
can't use where `id` like '%?%' in prepared statment ?Cifer Lee1 Mar