Binding Parameters 2
You might have noted in the earlier introduction to the execute method that the input_parameters parameter was optional. This is convenient because if you need to pass along numerous variables, providing an array in this manner can quickly become unwieldy. So what's the alternative The bindParam method. Its prototype follows boolean PDOStatement bindParam mixed parameter, mixed amp variable , int datatype , int length , mixed driver_options When using named parameters, parameter is the name of...
The foreachelse Function
The foreachelse function is used in conjunction with foreach, and operates much like the default tag does for strings, producing some alternative output if the array is empty. An example of a template using foreachelse follows foreach key key item item from titles key item lt br gt foreachelse lt p gt No states matching your query were found. lt p gt foreach Note that foreachelse does not use a closing bracket rather, it is embedded within foreach, much like an elseif is embedded within an if...
Setting Variables
The SET statement is used to set the value of a declared stored routine variable. Its prototype looks like this SET variable_name value , variable_name value The following example illustrates the process of declaring and setting a variable titled inv It's also possible to set variables using a SELECT INTO statement. For example, the inv variable can also be set like this SELECT inventory INTO inv FROM product WHERE productid MZC38373 Of course, this variable is local in scope to the BEGIN END...
allow_call_time_pass_reference = On | Off
Scope PHP_INI_SYSTEM Default value On Function arguments can be passed in two ways by value and by reference. Exactly how each argument is passed to a function at function call time can be specified in the function definition, which is the recommended means for doing so. However, you can force all arguments to be passed by reference at function call time by enabling allow_call_time_pass_reference. The discussion of PHP functions in Chapter 4 addresses how functional arguments can be passed both...
myisamchk
Although it is widely acknowledged that MySQL is quite stable, certain conditions out of its control can result in corrupt tables. Such corruption can wreak all sorts of havoc, including preventing further insertions or updates, and even resulting in the temporary and in extreme cases, permanent loss of data. If you experience any table errors or oddities, you can use the myisamchk utility to check MyISAM table indices for corruption, and repair them if necessary. It's invoked using the...
Installing Magpie
Like most PHP classes, Magpie is as simple to install as placing the relevant files within a directory that can later be referenced from a PHP script. The instructions for doing so follow 1. Download Magpie from http magpierss.sourceforge.net . 2. Extract the package contents to a location convenient for inclusion from a PHP script. For instance, consider placing third-party classes within an aptly named directory located within the PHP_INSTALL_DIR includes directory. Note that you can forgo...
■m
m modifier, Perl regular expressions, 240 M, m parameters, date function, 326 M parameter, numeric datatypes, 710 Macromedia Dreamweaver MX choosing code editor, 48 magic_quotes_gpc directive, PHP, 43, 97 magic_quotes_runtime directive, PHP, 43, 298, 43 magic_quotes_sybase directive, PHP, 44 parameters, 43 magic quotes, enabling, 43 MagpieRSS, 510-519 aggregating feeds, 516-517 caching feeds, 519 disabling caching, 519 features, 510 installing, 511 headlines, 518 parsing feeds, 511-515...