Re: need help for connecting the db in php



On Apr 26, 7:05 am, BigZero <vijaymajagaon...@xxxxxxxxx> 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_custom($db);
$db_connection = odbc_connect("DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=$db", "ADODB.Connection", "", "SQL_CUR_USE_ODBC");
   // $query         = "SELECT * FROM System_Master";
    //$result_id     = odbc_exec($connection_id,$query);
$result = odbc_tables($db_connection);
while (odbc_fetch_row($result)) {
    if(odbc_result($result,"TABLE_TYPE")=="TABLE") {
        echo "<br />" . odbc_result($result,"TABLE_NAME");
?>

by doing this i got error in ie as follows

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

any body help me to slove this problem

Thanks
Vijay

I think this
$db_connection = odbc_connect("DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=$db", "ADODB.Connection", "", "SQL_CUR_USE_ODBC");

needs to be this
$db_connection = odbc_connect("DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=" . $db, "ADODB.Connection", "", "SQL_CUR_USE_ODBC");
.



Relevant Pages

  • Re: need help for connecting the db in php
    ... i m working on project that has interface with simple html and php i m ... i got some problem with the connecting to DB here is the code for ...
    (comp.lang.php)
  • need help for connecting the db in php
    ... i m working on project that has interface with simple html and php i m ... i got some problem with the connecting to DB here is the code for ...
    (comp.lang.php)
  • Re: [PHP] Displaying files
    ... "If you're using IIS then it's the IUSR_machine user which doesn't have ... The IUSR_SERVERNAME account is what it should be connecting as whether I'm ... HTML WORKS ... PHP DOESN'T WORK ...
    (php.general)
  • Re: problem with simple php code
    ... This is an HTML line ... echo "This is a PHP line"; ... Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in ... there are now double quotes around the line ...
    (comp.lang.php)
  • Re: working with mysql
    ... throw new Exception('Error connecting to host. ... I would like to be able to get php to pull the data. ...
    (comp.lang.php)