need help for connecting the db in php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BigZero

    #1

    need help for connecting the db in php

    hello i m new to php
    i m working on project that has interface with simple html and php i m
    thinking to use
    i got some problem with the connecting to DB here is the code for
    connecting db



    $db = "Snmp_Dba";
    // $connection_id = odbc_connect_cu stom($db);
    $db_connection = odbc_connect("D RIVER={Microsof t Access Driver
    (*.mdb)}; DBQ=$db", "ADODB.Connecti on", "", "SQL_CUR_USE_OD BC");
    // $query = "SELECT * FROM System_Master";
    //$result_id = odbc_exec($conn ection_id,$quer y);
    $result = odbc_tables($db _connection);
    while (odbc_fetch_row ($result)) {
    if(odbc_result( $result,"TABLE_ TYPE")=="TABLE" ) {
    echo "<br />" . odbc_result($re sult,"TABLE_NAM E");
    ?>


    by doing this i got error in ie as follows

    Parse error: parse error in c:\program files\easyphp1-8\www\search.ph p
    on line 25

    any body help me to slove this problem

    Thanks
    Vijay
  • Jerry Stuckle

    #2
    Re: need help for connecting the db in php

    BigZero wrote:
    hello i m new to php
    i m working on project that has interface with simple html and php i m
    thinking to use
    i got some problem with the connecting to DB here is the code for
    connecting db
    >
    >
    >
    $db = "Snmp_Dba";
    // $connection_id = odbc_connect_cu stom($db);
    $db_connection = odbc_connect("D RIVER={Microsof t Access Driver
    (*.mdb)}; DBQ=$db", "ADODB.Connecti on", "", "SQL_CUR_USE_OD BC");
    // $query = "SELECT * FROM System_Master";
    //$result_id = odbc_exec($conn ection_id,$quer y);
    $result = odbc_tables($db _connection);
    while (odbc_fetch_row ($result)) {
    if(odbc_result( $result,"TABLE_ TYPE")=="TABLE" ) {
    echo "<br />" . odbc_result($re sult,"TABLE_NAM E");
    ?>
    >
    >
    by doing this i got error in ie as follows
    >
    Parse error: parse error in c:\program files\easyphp1-8\www\search.ph p
    on line 25
    >
    any body help me to slove this problem
    >
    Thanks
    Vijay
    >
    Which is line 25?

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Roger

      #3
      Re: need help for connecting the db in php

      On Apr 26, 7:05 am, BigZero <vijaymajagaon. ..@gmail.comwro te:
      hello i m new to php
      i m working on project that has interface with simple html and php i m
      thinking to use
      i got some problem with the connecting to DB here is the code for
      connecting db
      >
      $db = "Snmp_Dba";
        //  $connection_id = odbc_connect_cu stom($db);
      $db_connection = odbc_connect("D RIVER={Microsof t Access Driver
      (*.mdb)}; DBQ=$db", "ADODB.Connecti on", "", "SQL_CUR_USE_OD BC");
         // $query         = "SELECT * FROM System_Master";
          //$result_id     = odbc_exec($conn ection_id,$quer y);
      $result = odbc_tables($db _connection);
      while (odbc_fetch_row ($result)) {
          if(odbc_result( $result,"TABLE_ TYPE")=="TABLE" ) {
              echo "<br />" . odbc_result($re sult,"TABLE_NAM E");
      ?>
      >
      by doing this i got error in ie as follows
      >
      Parse error: parse error in c:\program files\easyphp1-8\www\search.ph p
      on line 25
      >
      any body help me to slove this problem
      >
      Thanks
      Vijay
      I think this
      $db_connection = odbc_connect("D RIVER={Microsof t Access Driver
      (*.mdb)}; DBQ=$db", "ADODB.Connecti on", "", "SQL_CUR_USE_OD BC");

      needs to be this
      $db_connection = odbc_connect("D RIVER={Microsof t Access Driver
      (*.mdb)}; DBQ=" . $db, "ADODB.Connecti on", "", "SQL_CUR_USE_OD BC");

      Comment

      • BigZero

        #4
        Re: need help for connecting the db in php

        Thanks
        i got solution for that,
        i chabged UserDsn to SystemDSN setting in control panel

        and all did change in code is
        $con = odbc_connect('M SAccessDriver', '','');

        any way thanks


        Regards
        Vijay


        Comment

        Working...