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: Tue, 27 Nov 2007

view this page in

Funciones mSQL

Introducción

Estas funciones le permiten acceder a servidores de bases de datos mSQL. Puede encontrar más información sobre mSQL en » http://www.hughes.com.au/.

Instalación

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

Configuración en tiempo de ejecución

El comportamiento de estas funciones está afectado por los valores definidos en 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  
For further details and definitions of the PHP_INI_* constants, see the Directivas de php.ini.

A continuación se presenta una corta explicación de las directivas de configuración.

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.

Tipos de recursos

Existen dos tipos de recurso usados en el módulo mSQL. El primero es el identificador de enlace para una conexión de base de datos, el segundo es un recurso que contiene el resultado de una consulta.

Constantes predefinidas

Estas constantes están definidas por esta extensión y estarán disponibles solamente cuando la extensión ha sido o bien compilada dentro de PHP o grabada dinámicamente en tiempo de ejecución.

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

Ejemplos

Este sencillo ejemplo muestra el modo de crear una conexión, ejecutar una consulta, imprimir las filas de resultado y desconectarse de una base de datos mSQL.

Example#1 Ejemplo de uso de mSQL

<?php
/* Conexión, selección de una base de datos */
$enlace msql_connect('localhost''nombre_usuario''contrasenya')
    or die(
'No pudo crearse una conexión: ' msql_error($enlace));

msql_select_db('base_de_datos'$enlace)
    or die(
'No pudo seleccionarse la base de datos');

/* Realizar una consulta SQL */
$consulta 'SELECT * FROM mi_tabla';
$resultado msql_query($consulta$enlace) or die('La consulta falló: ' msql_error());

/* Impresión de resultados en HTML */
echo "<table>\n";
while (
$fila msql_fetch_array($resultadoMSQL_ASSOC)) {
    echo 
"\t<tr>\n";
    foreach (
$fila as $valor_col) {
        echo 
"\t\t<td>$valor_col</td>\n";
    }
    echo 
"\t</tr>\n";
}
echo 
"</table>\n";

/* Liberar el conjunto de resultados */
msql_free_result($resultado);

/* Cerrar la conexión */
msql_close($enlace);
?>

Table of Contents



add a note add a note User Contributed Notes
mSQL
acroyear at io dot com
16-May-2000 12: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: Tue, 27 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites