What is the Declare function equivalent in a PHP database query?
I'm rewriting some existing stored procedure开发者_Go百科s in PHP but i'm not 100% sure what the DECLARE section of the stored procedure does. What is the PHP equivalent to this?
DECLARE
just (go figure) declares variables and their types for use in the stored procs. It basically says "this is variable X, and its type is Y".
PHP has no such strict requirements. Mostly you can just start using a variable without explicitly declaring it in advance. It's a good idea to actually declare them before use, but not required.
The MySQL doc-page for DECLARE is here: http://dev.mysql.com/doc/refman/5.0/en/variables-in-stored-programs.html
精彩评论