Sybase & PHP

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-16-2005
Data Goob
 
Posts: n/a
Default Sybase & PHP

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 ) ;

?>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:10 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0