Saturday, 9 June 2012

how to test PHP 5 compilation with sybase 15

While back I had to recompile PHP 5.x with Sybase 15 support. It wasn't difficult, but after compilation was finished, I had to test it somehow... and here's a small and basic piece of PHP code to test connection from PHP 5 to ASE 15 (Adaptive Server Enterprise).

----------

<?php
$db = sybase_connect("SERVER", "username", "password") or die("Could not connect !");
echo "Connected successfully<br>";
echo "handler: $db<br>";
$res = sybase_query("select column from table", $db);
 if($res)
 {
         echo "rows: sybase_num_rows($res)";
         while ($data = sybase_fetch_array($res)) {
          print("db: $data[0]\n");
         }
 sybase_free_result($res);
 } else  {
         echo "<br><br>false<br><br>";
         }
 echo "<br><br>last message from server:<br>";
 echo sybase_get_last_message();
 sybase_close($db);
?>

No comments:

Post a Comment