For the life of me, I cannot figure out why the below statement in my PHP script returns only one object. It is a mysql server it is communicating with and I have written this so far:
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();
mysqli_stmt_bind_result($stmt, $row->CustID, $row->CompanyID, $row->FirstName, $row->Surname, $row->CellNo, $row->Email);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
}
Now as far as I know, it should return all of my customers that have an CompanyID of variable. However, it just returns the first customer and that is all, nothing else.
Any ideas?
Also, one thing I want to do is concatenate FirstName and Surname, but I am not sure if I can do that in PHP. I am still learning this.
It should be: