182x Posted July 18, 2007 Share Posted July 18, 2007 Hey guys, Just wondering whats wrong with the following part of a table I am creating. Thanks. <tr><td><a href='$display['file']\">File Available</a></td></tr>"; Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/ Share on other sites More sharing options...
DeadEvil Posted July 18, 2007 Share Posted July 18, 2007 Try this one. print "<tr><td><a href=".$display['file'].">File Available</a></td></tr>"; Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/#findComment-301168 Share on other sites More sharing options...
182x Posted July 18, 2007 Author Share Posted July 18, 2007 Thanks I have used that for the following code which is used to display file links but only if a fiile is available for that record but its not displaying the file links. Where did I go wrong? Thanks again <?php while($display=mysql_fetch_array($q)) { if (empty($display['p'])) { $f = "<td></td>"; } else { $file = "<td>".$display['p']."</td>"; } echo "<tr class='style4'><td>".$display['Id']."</td><td>".$display['s']."</td><td><a href=".$display['f'].">test</a></td></tr>"; } ?> Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/#findComment-301179 Share on other sites More sharing options...
lur Posted July 18, 2007 Share Posted July 18, 2007 When $display['p'] is empty, you set $f to some html for an empty cell. When it is not empty, you set $file to a cell containing $display['p']. Finally you print neither $f nor $file, but $display['f']. Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/#findComment-301187 Share on other sites More sharing options...
jitesh Posted July 18, 2007 Share Posted July 18, 2007 while($display=mysql_fetch_array($q)) { echo "<pre>"; // Show us o/p print_r($display); if (empty($display['p'])) { $f = "<td></td>"; } else { ........ ......... Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/#findComment-301193 Share on other sites More sharing options...
182x Posted July 18, 2007 Author Share Posted July 18, 2007 I'm getting the following error with this line of code now, just wondering where the syntax is wrong with it. $f = "<td><a href=\"$display['p']\">".$display['p']."</a></td>"; error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\a\tec.php on line 83 Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/#findComment-301207 Share on other sites More sharing options...
DeadEvil Posted July 18, 2007 Share Posted July 18, 2007 $f = "<td><a href=".$display['p'].">".$display['p']."</a></td>"; Link to comment https://forums.phpfreaks.com/topic/60540-solved-output-syntax-error/#findComment-301224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.