php - Use bound variables more than once? -


i have lots of queries variable bound needs used more once. here's simple example.

$stmt = $db->prepare('select sum(col1),                        (select sum(col2)                       table2                       col3 > :val) quantity                        table1                       col4 = :val'); 

when this, error:

error!: sqlstate[hy093]: invalid parameter number in ...

there typically reasons why can't like

where col3 = col4 

in other words, there situations need use bound variable more once. in past, i've bound values multiple times different names.

is possible use bound variable more once?

either set pdo::attr_emulate_prepares true or use "slightly different names" approach. doesn't make difference though


Comments

Popular posts from this blog

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -