如題 最好能舉個簡單的例子

解决方案 »

  1.   

    以下摘自PHP手册You already have all the tools you need if you are running entirely under Windows 9x/Me, or NT/2000, where you can use ODBC and Microsoft's ODBC drivers for Microsoft Access databases.<?php
    // Microsoft SQL Server using the SQL Native Client 10.0 ODBC Driver - allows connection to SQL 7, 2000, 2005 and 2008
    $connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password);// Microsoft Access
    $connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);// Microsoft Excel
    $excelFile = realpath('C:/ExcelData.xls');
    $excelDir = dirname($excelFile);
    $connection = odbc_connect("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=$excelFile;DefaultDir=$excelDir" , '', '');
    ?>
      

  2.   

    这是windows下的东西如果你要在别的系统,如linux下用,需要安装支持软件才行有可能的话,还是用mysql吧
      

  3.   

    http://dev.firnow.com/course/4_webprogram/php/phpshil/200866/122943.html
      

  4.   

    <?php
    function getInfo($table,$field,$id,$colnum){
     $connstr = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=db1.mdb";
     $connid = @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC) or die ("數據庫錯誤!");
     $sql    = "select * from ".$table." where ".$field."=".$id;
     $query  = @odbc_do($connid,$sql);
     
     if(odbc_fetch_row($query)){
      for($i=0;$i<$colnum;$i++){
       $info[$i] = odbc_result($query,$i+1);
      }
     }
     return $info;
    }
    getInfo("order","id",1,2);
    ?>提示“數據庫錯誤” 這是為什麼呀? 期待高人指點
      

  5.   

    @odbc_connect($connstr,"","",SQL_CUR_USE_ODBC)用戶 和密碼 是空的