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>"; Quote Link to comment 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>"; Quote Link to comment 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>"; } ?> Quote Link to comment 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']. Quote Link to comment 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 { ........ ......... Quote Link to comment 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 Quote Link to comment 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>"; 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.