Jump to content

Simple Sybase Connect


ellchr3

Recommended Posts

I get the following error with the code below:  

Parse error: syntax error, unexpected T_IF in C:\prov

 

Any help is appreciated.  Thanks!

 

<?php

$link = sybase_connect("10.x.x.x:x", "x", "x")

if ( ! $link ) { 

       echo "Connection failed \n "             

    } else { 

       echo "Connected successfully \n " ;

      sybase_close($link);

?>
Link to comment
https://forums.phpfreaks.com/topic/276477-simple-sybase-connect/
Share on other sites

Okay, I found where I was missing a curly bracket too.  Updated code and error below.  It's not liking my connection parameters apparently.  

 

Below is the syntax for a sybase_connect.  Can you tell me if servername is the "Server Name" for Sybase, or the PC/server the database is on?  

 

 

sybase_connect ([ string $servername [, string $username [, string $password [, string $charset [, string $appname [, bool $new = false ]]]]]] )

 

Fatal error: Call to undefined function sybase_connect() in C.... on line 2

 

 

<?php
$link = sybase_connect("10.x.x.x:x", "x", "x");
if ( ! $link ) { 
       echo "Connection failed \n " ;           
    } else { 
       echo "Connected successfully \n " ;
    }
      sybase_close($link);
 
?>
 
Thanks for your help.

I found a way that works using odbc_connect.  I couldn't get anything to work with the sybase_connect no matter what I tried.  I don't think it included enough information about the server/database that way.

 

<?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={Sql Anywhere 11};".
                    "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";
 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.