BigX Posted March 31, 2008 Share Posted March 31, 2008 Hi, I have this piece of code and I get a Parse error: syntax error, unexpected '}' in line 173 which is the first if statement defining the header for the table! Probably a simple mistake... <?php if(isset($_GET['categorie'])) { $categorie = $_GET['categorie']; if( $categorie == "1" ) {$header = "Algemene Juridische Hulp"}; if( $categorie == "2" ) {$header = "Consumenten"}; if( $categorie == "5" ) {$header = "Vreemdelingen"}; if( $categorie == "8" ) {$header = "Wonen en Huur"}; $organisaties_categorie = mysql_query("SELECT * FROM organisaties WHERE Categorie=" . $categorie." ORDER BY Organisatie ASC"); echo "<table width='350' cellspacing='0' border='0'> <tr> <th width='20' style='color: #CB0042' bgcolor='#FFFFFF'><div class='style11'><b>"$header"</b></div></th> </tr> <tr> <th width='20' style='color: #CB0042' bgcolor='#FFFFFF'><div class='style11'><b> </b></div></th> </tr>"; ..... ?> Any help is appreciated! Link to comment https://forums.phpfreaks.com/topic/98896-find-the-error/ Share on other sites More sharing options...
teng84 Posted March 31, 2008 Share Posted March 31, 2008 $header = "Algemene Juridische Hulp"}; should be $header = "Algemene Juridische Hulp";} see those lines ... Link to comment https://forums.phpfreaks.com/topic/98896-find-the-error/#findComment-506023 Share on other sites More sharing options...
maxudaskin Posted March 31, 2008 Share Posted March 31, 2008 What he is trying to say is: <?php if( $categorie == "1" ) {$header = "Algemene Juridische Hulp"}; if( $categorie == "2" ) {$header = "Consumenten"}; if( $categorie == "5" ) {$header = "Vreemdelingen"}; if( $categorie == "8" ) {$header = "Wonen en Huur"}; ?> should be <?php if( $categorie == "1" ) {$header = "Algemene Juridische Hulp";} if( $categorie == "2" ) {$header = "Consumenten";} if( $categorie == "5" ) {$header = "Vreemdelingen";} if( $categorie == "8" ) {$header = "Wonen en Huur";} ?> The semicolon ( should go after the action, not the curly bracket... A good way to remember this is to write the code like this: <?php if( $categorie == "1" ){ $header = "Algemene Juridische Hulp"; }elseif( $categorie == "2" ){ $header = "Consumenten"; }elseif( $categorie == "5" ){ $header = "Vreemdelingen"; }elseif( $categorie == "8" ){ $header = "Wonen en Huur"; } ?> Link to comment https://forums.phpfreaks.com/topic/98896-find-the-error/#findComment-506027 Share on other sites More sharing options...
BigX Posted March 31, 2008 Author Share Posted March 31, 2008 Thanks guys, I will try it out immediately!! I thought the fix would be simple but when you don't know these easy little things, things go wrong pretty fast Link to comment https://forums.phpfreaks.com/topic/98896-find-the-error/#findComment-506028 Share on other sites More sharing options...
kenrbnsn Posted April 1, 2008 Share Posted April 1, 2008 I would use an array here: <?php $headers = array(1=>'Algemene Juridische Hulp',2=>'Consumenten',5=>'Vreemdelingen',8=>'Wonen en Huur'); $header = $headers[$categorie]; ?> Ken Link to comment https://forums.phpfreaks.com/topic/98896-find-the-error/#findComment-506068 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.