|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-10 21:10 UTC] sniper@php.net
[2003-07-18 18:50 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Hi, I am building a interface to execute a stored procedure on a WAN Sybase ASE 12.0 from a local Sybase ASE 12.0. However, the result is null when the stored procedure returned too many columns data. This works fine on a local Sybase ASE. ----------- SYBASE ------------ Column_name Type Length Prec --------------------- -------- ------ ---- TradeID varchar 20 NULL OrderID varchar 20 NULL SubOrderID int 4 NULL CurrencyPair char 6 NULL Rate float 8 NULL BuySell char 1 NULL CCY1Amount float 8 NULL DealDateTime datetime 8 NULL OriginatorID varchar 10 NULL TradeType char 1 NULL CCY2Amount float 8 NULL TraderID varchar 10 NULL ValueDate datetime 8 NULL Status char 2 NULL IMargin float 8 NULL MMargin float 8 NULL Commission float 8 NULL RatePips float 8 NULL Lots float 8 NULL SquareGroupID varchar 20 NULL HouseRatePips float 8 NULL AcceptedBy varchar 10 NULL LastChangedBy varchar 10 NULL DateTimeLastChanged datetime 8 NULL AdjustingPips float 8 NULL CreationDate datetime 8 NULL SquaredPNL float 8 NULL GeneratedBy varchar 4 NULL drop procedure sp_test go create procedure sp_test @idstring varchar(15) = NULL as select TradeID, OrderID, SubOrderID, CurrencyPair, Rate, BuySell, CCY1Amount, DealDateTime, OriginatorID, TradeType, CCY2Amount, TraderID, ValueDate, Status, IMargin, MMargin, Commission, RatePips, Lots, SquareGroupID, HouseRatePips, AcceptedBy, LastChangedBy, DateTimeLastChanged, AdjustingPips, CreationDate, SquaredPNL, GeneratedBy from Trades where TradeID like @idstring go grant execute on sp_test to user go ------------ PHP -------------- <? $intSecurity = 3; $intTimeOut = 1800; $cmd = $HTTP_GET_VARS['cmd']; $cmd = ereg_replace("\\\'", "'", $cmd); $cmd = ereg_replace('\\\"', '"', $cmd); print("<table border=1><tr><th>Command</th>\n"); printf("<td>%s</td></table><br>\n",$cmd); sybase_connect("sybase","user","user"); $result = sybase_query("$cmd"); //$result = sybase_query("exec syb2...sp_test 'idstr'"); //if ( $result == NULL ) //print("Null result..."); // // Print Heading In Table Format // print("<table border=1>"); while ($row = sybase_fetch_field($result)) { printf("<th>%s</th>", $row->name); } // // Print Data In Table Format // $j = sybase_num_fields($result); while ($row = sybase_fetch_array($result)) { print("<tr>"); $i = 0; while ($i < $j) { if ( $row[$i] == NULL ) printf("<td><br></td>"); else printf("<td>%s</td>", $row[$i]); $i++; } print("</tr>\n"); } print("</table><br>"); // // Print Sybase Error Message // print("<table border=1>"); $err = sybase_get_last_message(); //if ( $err != "Changed language setting to 'us_english'." ) if ( $err != NULL ) { printf("<tr><th>Error Message</th></tr>\n"); printf("<tr><td>%s</td></tr>\n",sybase_get_last_message()); } print("</table>"); sybase_close(); ?>