Jump to content

[SOLVED] Output syntax error


182x

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.