BigX Posted April 8, 2008 Share Posted April 8, 2008 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> "; } ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted April 8, 2008 Share Posted April 8, 2008 All your variables inside your echo should look like this: {$row['1eA_2eB_uitslag']} Do that to all of them and that should solve your problem. Quote Link to comment Share on other sites More sharing options...
kevin7 Posted April 8, 2008 Share Posted April 8, 2008 or, you can do like this ".$row['1eA_2eB_uitslag']." that's the hard way... but hey, i didnt know we can do that using curly brackets! Quote Link to comment Share on other sites More sharing options...
BigX Posted April 8, 2008 Author Share Posted April 8, 2008 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> "; } ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted April 8, 2008 Share Posted April 8, 2008 PHP works in mysterious ways ...I honestly don't have an answer for that one. Quote Link to comment Share on other sites More sharing options...
BigX Posted April 8, 2008 Author Share Posted April 8, 2008 PHP works in mysterious ways ...I honestly don't have an answer for that one. Yeah I guess PHP does work in mysterious ways cuz the '{' did the trick and now everything works fine!! 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.