Greetings all,
From what I have read of the documentation
here it looks as though you will need to use
$sth->bind_param() prior to your
$sth->execute() in order to correct your varchar vs. int problem.
As for your table locking issue (e.g. your multiple commands issue), it appears as though you will have to split those out (I wish I could point to something in the documentation but I was unable to locate even a part of your error in the docs or the source).
HTH
-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo