|
PHP, the PHP: Hypertext Preprocessor language, is an open source scripting language that can be embedded into HTML documents in order to generate dynamic content for the World Wide Web. PHP can be used with any Web server that supports the PHP scripting engine. Most PHP development is done with Apache server for Linux, but other Web servers, such as Microsoft’s IIS (Internet Information Server), can be configured to support PHP.
When a properly configured Web server reads a text file containing PHP commands, it runs the PHP scripting engine to execute those commands. The Web server then replaces the PHP commands with whatever output the scripting instructions call for. In most cases, the scripting commands are replaced either by simple text, HTML, or both.
Unlike client-side scripting, such as browser-executed JavaScript (or JScript or VBScript), all of the PHP commands are processed on the server the client browser never receives them. As a result, end users cannot discover the PHP commands that you include in your PHP files.
After installing the Advantage PHP Extension, you will need to configure your Web server to load the PHP extension. Refer to your Web server documentation or your PHP add-on documentation for information on how to configure your Web server to use the Advantage PHP Extension.
Once you have enabled the Advantage PHP Extension, you can call any of the ADS extended functions from within your PHP files. Table 16-2 contains a list of these available functions.
ads_autocommit | ads_binmode | ads_close |
ads_close_all | ads_columnprivileges | ads_columns |
ads_commit | ads_connect | ads_cursor |
ads_do | ads_error | ads_errormsg |
ads_exec | ads_execute | ads_fetch_array |
ads_fetch_into | ads_fetch_object | ads_fetch_row |
ads_field_len | ads_field_name | ads_field_num |
ads_field_precision | ads_field_scale | ads_field_type |
ads_foreignkeys | ads_free_result | ads_gettypeinfo |
ads_longreadlen | ads_next_result | ads_num_fields |
ads_num_rows | ads_pconnect | ads_prepare |
ads_primarykeys | ads_procedurecolumns | ads_procedures |
ads_result | ads_result_all | ads_rollback |
ads_setoption | ads_specialcolumns | ads_statistics |
ads_tableprivileges | ads_tables |
If you want to see a list of all of the functions supported by the Advantage PHP Extension, create and retrieve the following PHP file from a PHP-enabled Web server (or alternatively, add these commands to a file and pass the filename as a command-line parameter to the php.exe executable):
<html><body> <?$functions = get_extension_funcs('advantage'); echo "Functions available in the Advantage PHP Extension:<P>"; foreach($functions as $func) echo $func."<br>"; echo "<br>"; ?> </body> </html>
The following sections demonstrate how to perform a number of essential tasks with ADS and PHP. Unlike many of the examples of ADS access presented in the preceding chapters, these examples do not include administrative operations such as granting rights to a newly created table. While there is nothing to stop you from opening an administrative connection with PHP, these types of operations are rarely performed via a browser interface, as they represent a potential security risk. If you find that you do need to perform administrative tasks using PHP, extrapolate one or more of the examples given in earlier chapters using the PHP extended functions.
Note | In order to run the examples provided in the following section, you must have a PHP-enabled Web browser, and have correctly configured a Web server–accessible directory to hold these PHP executable files. See the documentation for performing these tasks, or visit http://www.php.net for further information. |
|