Jump to content

[SOLVED] Syntax Error


Bopo

Recommended Posts

Hi

 

I should really be able to see where it's going wrong, but I'm having one of those moments where I just can't figure it out  :-[

 

Parse error: syntax error, unexpected T_ELSE

 

<?php

$sql = "SELECT * FROM months where month = '$storemonth' AND year = '$storeyear'";

$query = mysql_query($sql, $connect);
while($row = mysql_fetch_assoc($query)){
   $month = $row['month'];
   $year = $row['year']; 
} else {  //this is the line that is being highlighted.

$sql = "INSERT INTO months (month, year) VALUES ('$storemonth', '$storeyear')";

if(!mysql_query($sql, $connect)) {
	die('Error' . mysql_error());		
}
mysql_close($connect);
}

?>

Link to comment
https://forums.phpfreaks.com/topic/154738-solved-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.