ellchr3 Posted April 3, 2013 Share Posted April 3, 2013 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/276477-simple-sybase-connect/ Share on other sites More sharing options...
trq Posted April 3, 2013 Share Posted April 3, 2013 You are missing a ; on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/276477-simple-sybase-connect/#findComment-1422633 Share on other sites More sharing options...
ellchr3 Posted April 3, 2013 Author Share Posted April 3, 2013 Trq, I tried that too and when I do that I get this: Parse error: syntax error, unexpected '}', expecting ',' or ';' in C: Quote Link to comment https://forums.phpfreaks.com/topic/276477-simple-sybase-connect/#findComment-1422640 Share on other sites More sharing options...
ellchr3 Posted April 3, 2013 Author Share Posted April 3, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/276477-simple-sybase-connect/#findComment-1422648 Share on other sites More sharing options...
Solution ellchr3 Posted April 3, 2013 Author Solution Share Posted April 3, 2013 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"; Quote Link to comment https://forums.phpfreaks.com/topic/276477-simple-sybase-connect/#findComment-1422715 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.