i have the problem, that i want to make an algorithm which reads the dates of every record from the database and check if it's the date from an array. When it's the right date, it will parse it to another array as the result.
$jahr = date("Y");
$monate = array(
array("Jan", $jahr."-01-01", $jahr."-01-31"),
array("Feb", $jahr."-02-01", $jahr."-02-29"),
array("Mär", $jahr."-03-01", $jahr."-03-31"),
array("Apr", $jahr."-04-01", $jahr."-04-30"),
array("Mai", $jahr."-05-01", $jahr."-05-31"),
array("Jun", $jahr."-06-01", $jahr."-06-30"),
array("Jul", $jahr."-07-01", $jahr."-07-31"),
array("Aug", $jahr."-08-01", $jahr."-08-31"),
array("Sep", $jahr."-09-01", $jahr."-09-30"),
array("Okt", $jahr."-10-01", $jahr."-10-31"),
array("Nov", $jahr."-11-01", $jahr."-11-30"),
array("Dez", $jahr."-12-01", $jahr."-12-31")
);
$betrag = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0);
$select = "SELECT * FROM database WHERE userID=1";
$query = mysql_query($select);
while($row = mysql_fetch_array($query)) {
for($i=0; $i<12; $i++) {
if($row['datum'] >= $monate[$i][1] && $row['datum'] <=0 $monate[$i][2]) {
$betrag[$i] += $row['betrag'];
}
}
}
The problem is, that i get this error message in the browser
Parse error: syntax error, unexpected '$monate' (T_VARIABLE) in test.php on line 29
line 29 is the line with the if statement
if($row['datum'] >= $monate[$i][1] && $row['datum'] <=0 $monate[$i][2]) {
In the msql database the row "datum" is formatted as "date"