I have a table that I am drawing information on that has a few fields. The two fields in particular that I need concatenated are Firstname and Surname but I cannot add another column to the actual table.
Is it possible to edit my PHP function to concatenate it for me when I call on it?
Here is my PHP function
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;
}
You can change your query as
then you change
to something like
And there you have it on one column