mysql_setup()


configuring for using MySQL

Description

void mysql_setup(int $udp_id, int $tcp_id[, string $dns_server = ""[, bool $ip6 = false]])

Parameters

Return Value

none

Example

<?php
include_once "/lib/sn_dns.php";     // DNS library
include_once "/lib/sn_mysql.php";

mysql_setup(4, 4, "", false);       // configuring TCP/IP ID for MySQL and DNS

$server_addr = "192.168.0.100";     // IP address of MySQL server
$user_name = "user_id";             // MySQL ID
$password = "password";             // MySQL password

// connect to a MySQL server
if(mysql_connect($server_addr, $user_name, $password) === false)
    exit(mysql_error());            // print the error message and quit

mysql_close();                      // disconnecting from the MySQL server
?>

See also