我有一個表,我正在繪製的信息,有幾個領域。特別需要連接的兩個字段是Firstname和Surname,但我不能將另一列添加到實際表中。如何在PHP函數中連接?
當我打電話時,是否可以編輯我的PHP函數來連接它?
這是我的PHP函數
public function getCustomerinfoByCompanyID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where CompanyID=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->CustID, $row->CompanyID, $row->FirstName, $row->Surname, $row->CellNo, $row->Email);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->CustID, $row->CompanyID, $row->FirstName, $row->Surname, $row->CellNo, $row->Email);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
這只是數據庫代碼。但是你談論輸出。請改爲輸出代碼。 – hakre 2012-02-28 23:52:30
AHHH退出使用程序API它如此令人反感! ;-) – prodigitalson 2012-02-28 23:52:54
@hakre:好的,他可以將屬性添加到'stdObject''s hes保溼,而不是直接在視圖中處理它。 – prodigitalson 2012-02-28 23:54:10