I would like to know how to fix this error any help would be appreciated:
Warning: Invalid argument supplied for foreach() in B:\webserver\xampp\htdocs\computers\printinvoice.php on line 39
here is the code and surrounding code
<?
// form is subitted
if (!empty($_POST)) {
$q = "SELECT FROM invoice WHERE id = '$invoice'"; // get the current entry
$r = mysql_query($q) or die(mysql_error()); // exec
$row = mysql_fetch_assoc($r); // fetch the row
foreach($row as $key => $val) {$data[$key] = $val;
};
//does the subtotal calculations that display on the invoice
$hwsubtotal1 = ($row['qty1'] $row['unitcost1']);
$hwsubtotal2 = ($row['qty2'] $row['unitcost2']);
$hwsubtotal3 = ($row['qty3'] $row['unitcost3']);
$hwsubtotal4 = ($row['qty4'] $row['unitcost4']);
$hwsubtotal5 = ($row['qty5'] $row['unitcost5']);
$hwsubtotal6 = ($row['qty6'] * $row['unitcost6']);
//subtotal all the harware types
$hwsub = ($hwsubtotal1 + $hwsubtotal2 + $hwsubtotal3 + $hwsubtotal4 + $hwsubtotal5 + $hwsubtotal6);
..........
............
............
Running php 5.2.4
Thanks, Kirk