I am trying to concatentate two variables in the php response file of an Ajax Script.
The Response file is the following:
$company_id=$_POST['company']:
$query="SELECT `contact_company`.`contact_id`, CONCAT(`surname`,' '.`fname`), `contact_company`.`company_id` FROM `seta`.`contact_company` AS `contact_company`, `seta`.`contacts` AS `contacts` WHERE `contact_company`.`contact_id` = `contacts`.`contact_id` AND `contact_company`.`company_id` ='".$company_id."' ";
$result=mysqli_query($connection,$query) or die ("Query to get data from contact_company table failed: ".mysqli_connect_error());
while ($row=mysqli_fetch_array($result)) {
$contact_id=$row["contact_id"];
$company_id=$row["company_id"];
$contact_name=$row["CONCAT(`surname`,' ',`fname`)"];
echo "<option value=\"$contact_id\">
$contact_name
</option>";
}
While this syntax of CONCAT works perfectly in the other php files, it doesn't here. Can anybody please advise? Thanks Regards
Tommaso