嗨,我有这个错误“可捕获的致命错误:类__PHP_Incomplete_Class的对象无法转换为第161行的C:\ xampp \ htdocs \ ProjectTA \ dao \ CustomerDao.php中的字符串”这样,我不知道解决这个问题我检查一切,一切都很好我
这是我的客户道歉
public function getOneCustomer($id) {
try {
$conn = Connection::getConnection();
$query = "select * from Customer c join Company comp on c.Company_IdCompany = comp.IdCompany JOIN City cit ON c.City_Id = cit.IdC WHERE c.IdCustomer = ?";
$stmt = $conn->prepare($query);
$stmt->bindParam(1, $id);
$stmt->execute();
$row = $stmt->fetch();
$customer = new Customer();
$customer->setIdCustomer($row['IdCustomer']);
$customer->setCustomerName($row['CustomerName']);
$customer->setPhoneNumber($row['PhoneNumber']);
$customer->setBankNumber($row['BankNumber']);
$customer->setCAddress($row['AddressC']);
$customer->setCEmail($row['EmailC']);
$customer->setPassword($row['Password']);
$customer->setCustomerStatus($row['CustomerStatus']);
$customer->setPhoto($row['Photo']);
$company = new Company();
$company->setIdCompany($row['IdCompany']);
$company->setCompanyName($row['CompanyName']);
$company->setWebsite($row['Website']);
$company->setPhone($row['Phone']);
$company->setEmail($row['Email']);
$company->setAddress($row['Address']);
$company->setLogo($row['Logo']);
$city = new city();
$city->setIdC($row['IdC']);
$city->setNameC($row['NameC']);
$customer->setCompany_IdCompany($company);
$customer->setCity_Id($city);
} catch (PDOexception $e) {
echo $e->getMessage();
die();
}
$conn = null;
return $customer;
}
我想在我的客户视图中显示
<?php
if (isset($_SESSION['IdCustomer'])) {
$dao = new CustomerDao();
$id = $_SESSION['IdCustomer'];
$dataInfo = $dao->getOneCustomer($id);
echo '<div class="col-md-12">
<div id="fh5co-tab-feature-vertical" class="fh5co-tab">
<ul class="resp-tabs-list hor_1">
<li><i class="fh5co-tab-menu-icon ti-ruler-pencil"></i> Company</li>
<li><i class="fh5co-tab-menu-icon ti-paint-bucket"></i> Project & Task</li>
<li><i class="fh5co-tab-menu-icon ti-shopping-cart"></i> Proof of Payment</li>
</ul>
<div class="resp-tabs-container hor_1">
<div>
<div class="row">
<div class="col-md-12">
<h2 class="h3">Company</h2>
</div>
<div class="col-md-6">
<h2>'.$dataInfo->getCustomerName().'</h2> // i want diplay customer name
</div>
</div>
</div>
</div>
</div>
</div>
</div>';
}&GT;
谢谢
答案 0 :(得分:0)
所以,我有一个解决这个问题的方法。在客户登录会话中验证数据登录时我错了