Retrieving data from MySQL in one SQL statement
- by james.ingham
Hi all,
If I'm getting my data from Mysql like so:
$result = $dbConnector->Query("SELECT * FROM branches, businesses WHERE branches.BusinessId = businesses.Id ORDER BY businesses.Name");
$resultNum = $dbConnector->GetNumRows($result);
if($resultNum > 0)
{
for($i=0; $i < $resultNum; $i++)
{
$row = $dbConnector->FetchArray($result);
// $row['businesses.Name'];
// $row['branches.Name'];
echo $row['Name'];
}
}
Does anyone know how to print the field Name in businesses and how to print the name from branches?
My only other alternative is to rename the fields or to call Mysql with two seperate queries.
Thanks in advance