У меня есть таблица, на которой я рисую информацию, в которой есть несколько полей. В частности, мне нужно объединить два поля: Имя и Фамилия, но я не могу добавить еще один столбец в фактическую таблицу.
Можно ли отредактировать мою функцию 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;
}