premora Posted March 31, 2011 Share Posted March 31, 2011 Hello, I am struggling here with a T_IF error. The IF Statement is inside a WHILE Loop and I have been searching for the dreaded missing ;'s that normally make these errors. Please help. The error line is in RED Here's the code: while ( $row = mysql_fetch_array($result) ) { echo("<table width='750' height='165' border='0' bgcolor='#DDDEFF' align='center'> <tr> <td width='107' height='30' align='center' bgcolor='#B73230'><b><font size='2' face='Arial, Helvetica, sans-serif' color='FFFFFF'>" . $row["name"] . "<br>ID: " . $row["L_ID"] . "</font></b></td> <td colspan='7' bgcolor='#2B2FE3' align='center'><img src='images/arrows.jpg'></td> </tr> <tr><td rowspan='4' valign='top'><div align=center><img src=images/avatar/".$row["L_ID"] ."s.jpg></div></td> <td width='10' rowspan='3'> </td> <td width='43' height='30'><b>Event: </b></td> <td width='100'><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["title"] . "</font></td> <td width='10' rowspan='3'> </td> <td align='right'><b>Location: </b></td> <td width='160'><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["location"] . "</font></td> <td width='170' align='center'><img src='images/titleAttendingEvents.jpg'></td> </tr> <td align='right' height='30'><b>Date: </b></td> <td><font size='2' face='Arial, Helvetica, sans-serif'>" . date('d/m/Y', strtotime($row['event_date'])) ."</font></td> <td align='right'><b>Post Code: </b></td> <td><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["postCode"] . "</font></td> <td width='170' align='center'><font size='4'>" . $row["attend"] . "</font></td> </tr> <tr> <td align='right' height='30'><b>Time: </b></td> <td height='30'><font size='2' face='Arial, Helvetica, sans-serif'>" . $row["time"] . "</font></td> <td align='right'><form name='email_host' method='post' action='email_host.php'><input type='hidden' name='id' value='" . $row["L_ID"] . "'><input type='hidden' name='title' value='" . $row["title"] . "'><input type='image' src='images/icons/email_s.jpg' align='absmiddle' height='30' alt='Email Host'><b><font size='2' face='Arial, Helvetica, sans-serif'> Email </b></font></form></td> <td align='center'><form name='attending' method='post' action='attend_send.php'><input type='hidden' name='id' value='" . $row["id"] . "'><input type='submit' name='attend_event' value='Attend Event'></form></td> <td width='170' align='center'><img src='images/icons_group.jpg'></td> </tr> <tr>" if ($row['cancel'] == 1) { echo "<td colspan='4' height='30' align='center'><font size='3' face='Arial, Helvetica, sans-serif' color='red'><b>CANCELLED</b></font</td>"; } else { echo "<td colspan='4' height='30'> </td>"; } echo " <td align='center' height='30'><form name='myForm' method='post' action='event_details.php'><input type='hidden' name='event_id' value='" . $row["id"] . "'><input type='image' src='images/btn_event_details.jpg' align='absmiddle' height='30' alt='View Full Event Details'></form></td> </tr> </table> <br>"); } Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/ Share on other sites More sharing options...
bh Posted March 31, 2011 Share Posted March 31, 2011 <tr>" if ($row['cancel'] == 1) { -> <tr>"; if ($row['cancel'] == 1) { And theres one more at the end of your code in echo statement. At the beginning of echo you dont use bracket, but at the end as finish you use it. Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/#findComment-1194860 Share on other sites More sharing options...
premora Posted March 31, 2011 Author Share Posted March 31, 2011 tried that but it still gives the same error so I removed it again Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/#findComment-1194864 Share on other sites More sharing options...
bh Posted March 31, 2011 Share Posted March 31, 2011 sry, i forgot the bracket: <tr>"); if ($row['cancel'] == 1) { Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/#findComment-1194865 Share on other sites More sharing options...
premora Posted March 31, 2011 Author Share Posted March 31, 2011 Now I get the error: Parse error: syntax error, unexpected ')', expecting ',' or ';' in Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/#findComment-1194866 Share on other sites More sharing options...
bh Posted March 31, 2011 Share Posted March 31, 2011 Yep, as i sad theres an other problem at the and of your code. Put a bracket after echo... echo (" <td align='center' height='30'><form name='myForm' method='post' action='event_details.php'><input type='hidden' name='event_id' value='" . $row["id"] . "'><input type='image' src='images/btn_event_details.jpg' align='absmiddle' height='30' alt='View Full Event Details'></form></td> </tr> </table> <br>"); } Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/#findComment-1194867 Share on other sites More sharing options...
premora Posted March 31, 2011 Author Share Posted March 31, 2011 What a Star - That's got it. Thanks so much Quote Link to comment https://forums.phpfreaks.com/topic/232272-parse-error-syntax-error-unexpected-t_if/#findComment-1194868 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.