Hi,
Just hoping someone can shed some light on a issue i am having. I am trying to pass data held from three tables into variables via a while loop. The data is stored in 3 tables: property, client, and invoice. I am happy that my SQL works, as when I pass it direct into phpmyadmin, I am getting the full range of data retruned from the 3 tables.
However, I seem to have an issue when it comes to passing the <client.‘data’> to a variable in the while loop. The <invoice.‘data’> is passed perfectly, and i can not see why the client data is different to make it not pass. I have pasted the relevant code below, pointers gratefully recieved.
$sql = "SELECT property.*, invoice.*, client.* FROM property INNER JOIN invoice ON property.id = invoice.id INNER JOIN client ON client.name = property.client WHERE property.client = '$client' AND invoice.dateinvoice != '' AND invoice.datepaid IS NULL AND invoice.sumId = 0 AND client.name='$client'";
echo 'SQL = '.$sql;
$result = mysqli_query($link, $sql);
while ($row = mysqli_fetch_array($result))
{
$updates[] = array(
'property.House_name' => $row['House_name'],
'property.house_number' => $row['house_number'],
'property.addline1' => $row['addline1'],
'property.addline2' => $row['addline2'],
'property.town' => $row['town'],
'property.county' => $row['county'],
'property.postcode' => $row['postcode'],
'property.fee' => $row['fee'],
'property.client' => $row['client'],
'property.id' => $row['id'],
'invoice.invoiceno' => $row ['invoiceno'],
'invoice.vatpercent' => $row ['vatpercent'],
'invoice.dateinvoice' => $row ['dateinvoice'],
'client.company' => $row ['clientname'],
'client.department' => $row ['clientdepartment'],
'client.add1' => $row ['clientadd1'],
'client.add2' => $row ['clientadd2'],
'client.town' => $row ['clienttown'],
'client.county' => $row ['clientcounty'],
'client.postcode' => $row ['clientpostcode']);
}
print_array($_POST);
print_array($updates);