PHP and Advantage Database Server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nathanwb
    New Member
    • Mar 2008
    • 39

    PHP and Advantage Database Server

    I have a server that has advantage database server installed on it. Date is stored in this database that I would like to access via PHP. I an fairly new to PHP but kinda now my way around. I have googled this and found few examples. I do have the Advantage ODBC connection setup but I am unable to connect to the database for some reason. This is the current code that I have.

    Now before you mention it there is no username or password assiciated with this database. I have checked.

    [php]
    <?php
    $conn=odbc_conn ect('ads','','' );
    if (!$conn)
    {exit("Connecti on Failed: " . $conn);}
    $sql="SELECT * FROM clmaster";
    $rs=odbc_exec($ conn,$sql);
    if (!$rs)
    {exit("Error in SQL");}
    echo "<table><tr >";
    echo "<th>Companynam e</th>";
    echo "<th>Contactnam e</th></tr>";
    while (odbc_fetch_row ($rs))
    {
    $compname=odbc_ result($rs,"Com panyName");
    $conname=odbc_r esult($rs,"Cont actName");
    echo "<tr><td>$compn ame</td>";
    echo "<td>$conna me</td></tr>";
    }
    odbc_close($con n);
    echo "</table>";
    ?>
    [/php]
  • samatair
    New Member
    • Nov 2007
    • 61

    #2
    Hi
    In Windows XP system, I installed a trial version of the Advantage Server and created a
    System DNS from the Control Panel->Administrati ve Tools->Data Sources(ODBC).
    and used the DNS name in the odbc_connect function like you have did ('ads' in your code)
    and used your code to create a table and fetch records. It worked.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

      How exactly isn't it working?
      Are you getting any errors? If not, check out this article and try again.

      Comment

      • nathanwb
        New Member
        • Mar 2008
        • 39

        #4
        this is the error I get

        Code:
        Warning: odbc_exec() [function.odbc-exec]: SQL error: [Extended Systems][Advantage SQL][ASA] Error 7200: AQE Error: State = HY000; NativeError = 5004; [Extended Systems][Advantage SQL][ASA] Error 5004: Either ACE could not find the specified file, or you do not have sufficient rights to access the file., SQL state HY000 in SQLExecDirect in D:\web\socad\ctest.php on line 8
        Error in SQL

        Comment

        Working...