PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

msql_affected_rows> <msession_unlock
Last updated: Sun, 25 Nov 2007

view this page in

mSQL Functions

简介

These functions allow you to access mSQL database servers. More information about mSQL can be found at » http://www.hughes.com.au/.

安装

In order to have these functions available, you must compile PHP with msql support by using the --with-msql[=DIR] option. DIR is the mSQL base install directory, defaults to /usr/local/msql3.

Note: Note to Win32 Users In order for this extension to work, there are DLL files that must be available to the Windows system PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the systems PATH), it is not recommended. This extension requires the following files to be in the PATH: msql.dll

运行时配置

这些函数的行为受 php.ini 的影响。

mSQL configuration options
Name Default Changeable Changelog
msql.allow_persistent "1" PHP_INI_ALL  
msql.max_persistent "-1" PHP_INI_ALL  
msql.max_links "-1" PHP_INI_ALL  
有关 PHP_INI_* 常量进一步的细节与定义参见php.ini 配置选项

以下是配置选项的简要解释。

msql.allow_persistent boolean

Whether to allow persistent mSQL connections.

msql.max_persistent integer

The maximum number of persistent mSQL connections per process.

The maximum number of mSQL connections per process, including persistent connections.

资源类型

There are two resource types used in the mSQL module. The first one is the link identifier for a database connection, the second a resource which holds the result of a query.

预定义常量

以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。

MSQL_ASSOC (integer)
MSQL_NUM (integer)
MSQL_BOTH (integer)

范例

This simple example shows how to connect, execute a query, print resulting rows and disconnect from a mSQL database.

Example#1 mSQL usage example

<?php
/* Connecting, selecting database */
$link msql_connect('localhost''username''password')
    or die(
'Could not connect : ' msql_error($link));

msql_select_db('database'$link)
    or die(
'Could not select database');

/* Issue SQL query */
$query 'SELECT * FROM my_table';
$result msql_query($query$link) or die('Query failed : ' msql_error());

/* Printing results in HTML */
echo "<table>\n";
while (
$row msql_fetch_array($resultMSQL_ASSOC)) {
    echo 
"\t<tr>\n";
    foreach (
$row as $col_value) {
        echo 
"\t\t<td>$col_value</td>\n";
    }
    echo 
"\t</tr>\n";
}
echo 
"</table>\n";

/* Free result set */
msql_free_result($result);

/* Close connection */
msql_close($link);
?>

Table of Contents



add a note add a note User Contributed Notes
mSQL
acroyear at io dot com
16-May-2000 05:11
To those porting code from w3-msql/lite to php, a few functions are different or missing (aside from the fact that the order of arguments is reversed and the other signatures are different...not good design work, imho, or was it built for msql 1.x?  At any rate, conformity with the C and Lite API should have been maintained.).

The lite/C function msqlStoreResult() is automatically done in msql_query() and msql(). 
msql_fetch_field() doesn't give you the field length value (unlike msqlFetchField()).  You have to call msql_fieldlen() to get that.

msqlEncode() is missing.  The functionality (which is needed for pretty much ALL SQL based rdbms's) is in addSlashes() in the String library.

msql_affected_rows> <msession_unlock
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites