thomasj Posted July 28, 2009 Share Posted July 28, 2009 I get this error: Parse error: parse error, expecting `')'' in C:\xampp\htdocs\thomasweb\overzicht.php on line 26 for ($nr=0; $nr < $amount; nr++) { // this is line 26 $fieldname= strtolower(mysql_field_name($resultaat, $nr)); echo "<td class=\"kop\">$fieldname</td>"; } I don't get what's wrong. Can you help me? Link to comment https://forums.phpfreaks.com/topic/167797-help-parse-error-expecting/ Share on other sites More sharing options...
rhodesa Posted July 28, 2009 Share Posted July 28, 2009 What are the lines before it...you are probably missing a semi-colon somewhere Link to comment https://forums.phpfreaks.com/topic/167797-help-parse-error-expecting/#findComment-884937 Share on other sites More sharing options...
thomasj Posted July 28, 2009 Author Share Posted July 28, 2009 <html> <head> <title>Overzicht van nieuwsberichten</title> <style> >!- p, td, {font-family:'Verdana, Arial'; font-size: 11pt} -> </style> </head> <body> <?php $link = mysql_connect('localhost', 'root', ''); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('nieuwssysteem', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } $sql= "SELECT titel, nieuwsbericht, geplaatst FROM nieuwsberichten"; $resultaat= mysql_query($sql); $aantal= mysql_num_fields($resultaat); echo "<table border=\"1\">"; echo "<tr>"; for ($nr=0; $nr < $aantal; nr++) { $veldnaam= strtolower(mysql_field_name($resultaat, $nr)); echo "<td class=\"kop\">$veldnaam</td>"; } echo "</tr>"; $rijen = mysql_num_rows($resultaat); if ($rijen > 0) { for ($nr=0; nr < $rijen; $nr++) { echo "<tr>"; for ($velden=0; $velden < $aantal; $velden++) { $waarde = mysql_result($resultaat, $nr, $velden); if (!waarde) { $waarde= " "; } echo "<td>$waarde</td>"; } } echo"</table>"; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/167797-help-parse-error-expecting/#findComment-884938 Share on other sites More sharing options...
thomasj Posted July 28, 2009 Author Share Posted July 28, 2009 am I missing something? dont see anything wrong with it Link to comment https://forums.phpfreaks.com/topic/167797-help-parse-error-expecting/#findComment-884942 Share on other sites More sharing options...
rhodesa Posted July 28, 2009 Share Posted July 28, 2009 3 problems...fixed and commented: <html> <head> <title>Overzicht van nieuwsberichten</title> <style> >!- p, td, {font-family:'Verdana, Arial'; font-size: 11pt} -> </style> </head> <body> <?php $link = mysql_connect('localhost', 'root', ''); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('nieuwssysteem', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } $sql= "SELECT titel, nieuwsbericht, geplaatst FROM nieuwsberichten"; $resultaat= mysql_query($sql); $aantal= mysql_num_fields($resultaat); echo "<table border=\"1\">"; echo "<tr>"; for ($nr=0; $nr < $aantal; $nr++) { //Missing $ on $nr $veldnaam= strtolower(mysql_field_name($resultaat, $nr)); echo "<td class=\"kop\">$veldnaam</td>"; } echo "</tr>"; $rijen = mysql_num_rows($resultaat); if ($rijen > 0) { for ($nr=0; $nr < $rijen; $nr++) { //Missing $ on $nr echo "<tr>"; for ($velden=0; $velden < $aantal; $velden++) { $waarde = mysql_result($resultaat, $nr, $velden); if (!waarde) { $waarde= " "; } echo "<td>$waarde</td>"; }//Missing brace here } } echo"</table>"; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/167797-help-parse-error-expecting/#findComment-884950 Share on other sites More sharing options...
thomasj Posted July 28, 2009 Author Share Posted July 28, 2009 I could go down on you. THANKS Link to comment https://forums.phpfreaks.com/topic/167797-help-parse-error-expecting/#findComment-884956 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.