This may be a completely dumb question, but I've seen a couple examples declaring the variables AFTER putting them in bind_param:
http://devzone.zend.com/article/686
I've never seen this done before and all my programming knowledge says I should define them before hand. Is this a valid/preferred way?
This is possible, because what gets bound is a reference to the variable in question, but I find it horribly bad style:
It makes code harder to read, maintain and debug - the variable could be changed further down the line, or even in other functions called in between the binding and the query.
Binding a variable before declaring it will throw an(No it doesn't. Cheers @webbiedave)E_NOTICE
messageIf you ask me, a query should be built in one place, and then executed straight away, for the sake of future readability.