This is a discussion on Sybase & PHP within the PHP Language forums, part of the PHP Programming Forums category; Hi, I had trouble using FreeTDS with Sybase ASE 12.5.2 DE. I kept getting errors when trying to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I had trouble using FreeTDS with Sybase ASE 12.5.2 DE. I kept getting errors when trying to run a stored procedure, using the PHP program found at the end of this post. php: dblib.c:303: buffer_add_row: Assertion `row_size <= buf->element_size' failed. Aborted But now having uninstalled FreeTDS, and trying to connect to my databases, I can no longer connect. PHP Warning: sybase_select_db(): Sybase: A link to the server could not be established in ... What do I have to do to connect PHP to Sybase? I also have downloaded iAnyWhere and installed it, but I don't know if I needed it or not, or if it can even help. Very confused. Do I need to re-install FreeTDS or is there a lib already in Sybase? ( Using Sybase ASE 12.5.2 DE ) Thanks in advance! My last configure command: ../configure \ --with-apache2=../httpd-2.0.53 \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl \ --with-mysql \ --with-dbase \ --with-ttf \ --with-curl \ --with-gd \ --with-gnu-ld \ --with-module=so \ --with-zlib \ --with-sqlanywhere=/opt/sybase/SYBSsa9/ \ --with-sybase=/opt/sybase/OCS-12_5 \ --with-mcrypt Test Program: ( worked fine with SQL but not stored procedures when FreeTDS was installed ) <?php $servername = "my-server-here" ; $portnumber = "5000" ; $username = "sa" ; $password = "" ; $database = "master" ; $db = sybase_connect("$servername:$portnumber","$usernam e", "$password"); sybase_select_db ( "$database" ); $q = sybase_query("sp_server_info", $db); # $q = sybase_query("${database}..sp_help", $db); # $q = sybase_query("select * from sysobjects", $db); $syb_num_fields = sybase_num_fields( $q ) ; $syb_num_rows = sybase_num_rows( $q ) ; $row_cnt = 0 ; $field_cnt = 0 ; while($row = sybase_fetch_row($q)) { if ( $row_cnt == 0 ) { for ( $f=1; $f<=$syb_num_fields;$f++) { $info = sybase_fetch_field($q); print "[$info->name]"; if ( $field_cnt == $syb_num_fields ) { print "\n" ; $field_cnt = 0 ; } } print "\n" ; } ++$row_cnt ; $field_cnt = 0 ; while(list($k, $v) = each($row)) { ++$field_cnt; $datum = NULL ; $datum = rtrim ( $v ) ; print "[$datum]" ; if ( $field_cnt == $syb_num_fields ) { print "\n" ; $field_cnt = 0 ; } } } sybase_close ( $db ) ; ?> |