PHP调用Sybase数据库函数列表

时间:2014-05-08 16:34:58

标签: php sql sybase

我正在使用sybase数据库在PHP中创建一个应用程序。目前,我可以调用特定的数据库函数,然后使用此数据使用此函数中的数据创建报告页面:

$sqld = "select WAppRCashTransactions('". $siteid ."','". $startDate ."','". $endDate ."','". $sid ."')";
  $result = sasql_query($connect, "$sqld");
    $row = sasql_fetch_row($result);
     echo $row[0];

然而,为了使这个动态,我需要从以

开头的数据库中调用ANY函数
  

WAppR

生成一个函数名列表,这样我就可以有一个动态页面来调用我选择的任何函数,但我不知道怎么做!

由于

1 个答案:

答案 0 :(得分:0)

我找到了问题的答案,如果有人需要,我会找到代码!

            <?php 

                //the SQL to get the procedure names
                $sql = "SELECT a.proc_name FROM SYSPROCEDURE a WHERE a.proc_name like 'WAppR%' ORDER BY a.proc_name";
                $funcResult = sasql_query($connect, "$sql");

                while($row = sasql_fetch_array($funcResult))
                {
                                            //function name as $functionName
                    $functionName=$row['proc_name'];
                                            //code to display the names nicely without the WAppR_
                    list($a, $title) = explode('_', $functionName);
                    $word=preg_replace('/(?<! )(?<!^)[A-Z]/',' $0', $title);

                                            //list the report names
                    echo "<li><a href='./reportManager.php?fname=$functionName'>$word</a></li>  ";
                }



            ?>