PHP 8.5.0 Alpha 4 available for testing

Voting

: max(one, four)?
(Example: nine)

The Note You're Voting On

aamaral at 0kbps dot net
20 years ago
To connect to Sybase SQL Server Anywhere 8.0 on Windows use the following:

<?php
//================================================================

// Configure connection parameters
$db_host = "server.mynetwork";
$db_server_name = "Dev_Server";
$db_name = "Dev_Data";
$db_file = 'c:\dbstorage\dev.db';
$db_conn_name = "php_script";
$db_user = "dbuser";
$db_pass = "dbpass";

//================================================================
$connect_string = "Driver={Adaptive Server Anywhere 8.0};".
"CommLinks=tcpip(Host=$db_host);".
"ServerName=$db_server_name;".
"DatabaseName=$db_name;".
"DatabaseFile=$db_file;".
"ConnectionName=$db_conn_name;".
"uid=$db_user;pwd=$db_pass";

// Connect to DB
$conn = odbc_connect($connect_string,'','');

// Query
$qry = "SELECT * FROM my_table";

// Get Result
$result = odbc_exec($conn,$qry);

// Get Data From Result
while ($data[] = odbc_fetch_array($result));

// Free Result
odbc_free_result($result);

// Close Connection
odbc_close($conn);

// Show data
print_r($data);

//================================================================
?>

<< Back to user notes page

To Top