I am facing some problems when creating my while loop within PHP. I want to be able to pull data out from multiple tables within a while loop. For example I have a table called Invoices and a second table called Customers. Both tables have a field named Email, and whenever I am trying to print or echo that row, then I only get one of them.. Maybe you could have a look at my code.
<?
$invoice_edit_query = $db->query("SELECT * FROM invoices, customers
WHERE invoice.customer_id = kunder.id AND
invoices.kunde_id = '$_GET[edit]' AND
invoices.invoice_year = '$_GET[year]' AND
invoices.invoice_nr = '$_GET[nr]'") or die(mysqli_error($db));
while($row = $invoice_edit_query->fetch_object()){
?>
<td>Email: <input type="text" name="email" value="<? print $row->email; ?>"></td>
<?
}
?>
Is there a way to print the values of my tables like the WHERE statement invoices.email or customers.email? Maybe instead of writing:
$row->email;
then writing:
$row->invoices.email;
var_dump($row)inside your loop?