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

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -