I am trying to do 2 completely unrelated queries on a mysql database with prepared statements in php. Is it possible to do this with one prepared statement object, or do I need more?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are they the same statement but with different conditions? ie:
Which you would then call multiple times with your various emails and user_ids.
That’s basically what prepared statements are for. The query planner can then plan once and execute many times.
If you have two different queries thought then you could overwrite the statement of your prepared statement object, and you may save an insignificant amount of time by not insubstantiating a new object, but you’re not actually getting added efficiency of prepared statements.