0

phpで助けてください

<?php
include("../../php-form-builder-class/class.form.php");
$form = new form("HDFC_SDM");
session_start();
$form->setAttributes(array(    
    "width" => 400
));
$form->addTextbox("SRNO  :","SrNo","");
$form->addTextbox("First Name  :","FName","");
$form->addTextbox("Middle Name :","MName","");
$form->addTextbox("Last Name   :","LName","");
$form->addTextbox("Address L1  :","AddL1","");
$form->addTextbox("Address L2  :","AddL2","");
$form->addTextbox("Address L3  :","AddL3","");
$form->addTextbox("City        :","City","");
$form->addTextbox("State       :","State","");
$form->addTextbox("Telephone   :","TFone","");
$form->addTextbox("Mobile      :","MFone","");
$form->addTextbox("Status      :","Statu","");
$form->addTextbox("Notes       :","Notes","");
$form->addRadio("Address Proof :","AProof","",array("1" => "Ration Card", "2" => "Electricity Bill", "3" => "Election Card"));
$form->addFile("Address Proof Xerox", "AProofX");
$form->addRadio("Identity Proof :","IProof","",array("1" => "Pan Card", "2" => "Nationalize Bank Identity", "3" => "Election Card"));
$form->addFile("Identity Proof Xerox", "IProofX");
$form->addRadio("DOB Proof :","DProof","",array("1" => "Pan Card", "2" => "Form No. 9", "3" => "Election Card"));
$form->addFile("DOB Proof Xerox", "DProofX");
$form->addButton();
try{
    $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$HDFCSDM", "", "");
}
catch(PDOException $e){
    echo $e->getMessage();
}
$form->render();

?>

以下にこのエラーがあります:

Undefined variable: 

HDFCSDM in C:\wamp\www\MY HDFC PROJECT\DEMO\helloworld.php on line 29
could not find driver
4

2 に答える 2

1

接続文字列内で使用される変数を定義していません$HDFCSDM(変数は二重引用符で囲まれた文字列内で展開されます)。最初に定義した場合、エラーは発生しません。

$HDFCSDM = "C:\\file.mdb";
try{
    $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$HDFCSDM", "", "");
}
于 2012-10-01T15:28:05.683 に答える
0

DSN接続を行う場合:

$db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\DataDir\DB_NAME.mdb;DefaultDir=C:\DataDir"; 

DBQパラメーターはデータベースを指します。私はそれが起こっているのを見ていません。コードまたはこの宣言の前半で定義する必要があります。

于 2012-10-01T15:29:34.357 に答える