Jump to content

[SOLVED] Syntax error problem! Losing my mind!!


BigX

Recommended Posts

Hi guys,

 

I have this code and I get a syntax error, unexpected T_STRING, expecting ']' in %%% line 437! This is the line where the $row is first echo'd in the table!! I have stared endlessly at the code but I just don't get it! I have simmilar pieces of code that work like a charm  so it really is strange! I also checked the sql queries and they are correct as are the column names! Can anyone help me with this?? Thanks in advance!!

 

<?php
  
  $id = $_GET['id_usr'];
  $result = mysql_query("SELECT * FROM `kwartfinales` WHERE user_id=" . $id);
  echo "<table width='450' border='0'>";
     while($row = mysql_fetch_array($result)){
 echo "<tr>
          <td width='250' align='left' style='font-size: 20px' bgcolor='#FFFFFF'><u><b>Kwartfinales</b></u></td>
	  <td width='100' align='left' style='font-size: 20px' bgcolor='#FFFFFF'><u><b>Uitslag</b></u></td>
	  <td width='100' align='left' style='font-size: 20px' bgcolor='#FFFFFF'><u><b>Winnaar</b></u></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Wedstrijd 25: A#1 - B#2</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[1eA_2eB_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[winnaar_25]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Wedstrijd 26: B#1 - A#2</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[1eB_2eA_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[winnaar_26]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Wedstrijd 27: C#1 - D#2</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[1eC_2eD_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[winnaar_27]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Wedstrijd 28: D#1 - C#2</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[1eD_2eC_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[winnaar_28]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b> </b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b> </b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b> </b></td>
          </tr>
  	";
     }

  
  ?>

Link to comment
Share on other sites

Thanks guys! I'll try that immediately! But why does this code for example work perfectly! Here i also didn't use the curly brackets or the dots!

 

 <?php
  
  $id = $_GET['id_usr'];
  $result = mysql_query("SELECT * FROM `poule_d` WHERE user_id=" . $id);
  echo "<table width='450' border='0'>";
     while($row = mysql_fetch_array($result)){
 echo "<tr>
          <td width='250' align='left' style='font-size: 20px' bgcolor='#FFFFFF'><u><b>Poule D</b></u></td>
	  <td width='100' align='left' style='font-size: 20px' bgcolor='#FFFFFF'><u><b>Uitslag</b></u></td>
	  <td width='100' align='left' style='font-size: 20px' bgcolor='#FFFFFF'><u><b>Toto</b></u></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Spanje - Rusland</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[spa_rus_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[spa_rus_toto]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Griekenland - Zweden</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[gri_zwe_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[gri_zwe_toto]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Zweden - Spanje</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[zwe_spa_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[zwe_spa_toto]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Griekenland - Rusland</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[gri_rus_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[gri_rus_toto]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Griekenland - Spanje</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[gri_spa_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[gri_spa_toto]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b>Rusland - Zweden</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[rus_zwe_uitslag]</b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b>$row[rus_zwe_toto]</b></td>
          </tr>
	  <tr>
          <td width='250' align='left' style='font-size: 14px' bgcolor='#FFFFFF'><b> </b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b> </b></td>
	  <td width='100' align='left' style='color: #CC0000' style='font-size: 14px' bgcolor='#FFFFFF'><b> </b></td>
          </tr>
  	";
     }

  
  ?>

Link to comment
Share on other sites

PHP works in mysterious ways :P ...I honestly don't have an answer for that one.

 

;D Yeah I guess PHP does work in mysterious ways cuz the '{' did the trick and now everything works fine!!  ;D i really don't know why they are needed here and not in the code I showed above, since the codes look almost exactly alike! But hey, I'm glad it works now! Thanks for your input!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.