Hey,
I wrote this code, to make a dynamic table, but I keep getting Syntax error, and I can't see where that error is, plz help.
mysql_connect ("localhost", "USERNAME", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
// Select the database
mysql_select_db ("DATABASE")
or die ("Could not select database");
// Store Settings
$gable_max_colo = "9";
$box_max_fresh = "2";
$box_max_frozen = "2";
// Getting data
$dep = 'Colonial';
$displayT = 'Gable';
$res = mysql_query("SELECT * FROM Marketing WHERE Year='".$_POST['year']."' and Week='".$_POST['week']."'");
while ($row = mysql_fetch_array($res)){
$dep = $row['Department'];
$displayT = $row['DisplayType'];
if ($dep == 'Colonial'){
if ($displayT == 'Gable'){
$number = '1';
while ($number > $gable_max_colo){
$result = mysql_query("SELECT * FROM Marketing WHERE Year'".$_POST['year']."' and Number='".$number."' and DisplayType='".$displayT."' and Department='".$dep."' and Week='".$_POST['week']."'");
$html_start = '<h2>Endegavl'.$number.'</h2>
<table border="1" cellspacing="4" cellpadding="4">
<tr>
<th>Brand</th>
<th align="right">Product</th>
<th align="left">Type</th>
<th>Price</th>
</tr>';
while ($row = mysql_fetch_array($result)){
$Product = $row['Product'];
$Brand = $row['Brand'];
$Price = $row['Price'];
$ProductT = $row['ProductType'];
$Count = $row['Count'];
$Goods = $row['Goodsnr'];
$html_inside .= '
<tr>
<td>'.$Brand.'</td>
<td>'.$Product.'</td>
<td>'.$Type.'</td>
<td>'.$Price.'</td>
</tr>';
}
$html_end = '</table>';
$number = $number + 1;
}
}
}
echo $html_start;
echo $html_inside;
echo $html_end;