|
|
|
สอบถาม Fatal error: Call to a member function query() on a non-object |
|
|
|
|
|
|
|
มันเรียกใช้งาน function query ไม่ได้ครับ ไม่ทราบว่าโค๊ดได้สืบทอด class นี้มาหรือยังครับ
Code (PHP)
<?PHP
$str = new class_name(); //ชื่อ class
$str = "SELECT tb_Center.CenterNo, tb_Function.Function_Name, tb_Contract.Contract_No,tb_Equipment_Type.Equipment_Type, tb_Purchase.Budget_New,
tb_Purchase.Budget_Replace, tb_Equipment.Budget_Price
FROM (tb_Function INNER JOIN (tb_Center_Function INNER JOIN tb_Center ON tb_Center_Function.ID_Center = tb_Center.ID_Center)
ON tb_Function.ID_Function = tb_Center_Function.ID_Function)
INNER JOIN ((tb_Equipment_Type INNER JOIN (tb_Contract INNER JOIN tb_Equipment ON tb_Contract.ID_Contract = tb_Equipment.ID_Contract)
ON tb_Equipment_Type.ID_Equipment_Type = tb_Equipment.ID_Equipment_Type) INNER JOIN tb_Purchase ON tb_Equipment.ID_Equipment = tb_Purchase.ID_Equipment)
ON tb_Function.ID_Function = tb_Purchase.ID_Function
where tb_Contract.ID_Contract = ".$selcontract;
$result = $db->query($str);
while ($row=$result->fetch()){
$CenterNo= $row['CenterNo'];
$Contract_No= $row['Contract_No'];
$Functionname= $row['Function_Name'];
$Equipment_Type= $row['Equipment_Type'];
$Budget_New = $row['Budget_New'];
$Budget_Replace=$row['Budget_Replace'];
$Budget_Price= $row['Budget_Price'];
$RentMonth = $Budget_Price*($Budget_New+$Budget_Replace);
$RentYear = $RentMonth*12;
$RentYear3 = $RentYear*3;
}
}
?>
|
|
|
|
|
Date :
2012-08-20 11:18:42 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยัง ไม่ได้สืบทอดค่ะ รบกวนช่วยอธิบายด้วยน่ะค่ะ..... มือใหม่หัดเขียนอ่ะค่ะ ขอบคุณค่ะ
|
|
|
|
|
Date :
2012-08-20 11:31:47 |
By :
mah_comsci |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|