I have 2 prepared statements in function. After I get result from first, I need one field's value from this result to be used in second statement as bind_param()
function's parameter. But I was getting error, until I found out about store_result()
function and used it after first statement. So can you tell or give some reference to read, why is there need to use store_result()
function and why this problem arises, during using 2 prepared statements.
I don't know if I am right, but in my opinion this happens because I am not closing first statement before starting second and maybe because of both are open, some error arises.
EDIT:
I found out some information, that somehow helps me to solve this problem
Command out of sync:
This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without calling mysql_use_result() or mysql_store_result() in between.