Associative arrays and binding parameters
12:16 12 Apr 2009

I've gotten a little confused with the PDO::prepare functions.

I have something like this

array('user_email'=>'hello@net.com','user_pass'=>'password')

and i'd like to translate it into something like this

INSERT INTO user_info (user_email, user_pass) VALUES (hello@net.com, password)

using parameterized queries with PDO (or mysqli, I'm open to suggestions). Another idea -

array('uid'=>'10', 'first_name'=>'robert', 'last_name'=>'jones')
array("email", "number")

into

SELECT email, number FROM t1 WHERE uid=10 AND first_name=robert AND last_name=jones

I know the answer lies somewhere with PDO::prepare and call_user_func_array, but I've gotten really confused on how the latter function works, and would appreciate an explanation.

php pdo