Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

heredoc issue

Status
Not open for further replies.

rrsub

MIS
Joined
Oct 23, 2002
Messages
536
Location
US
I'm using heredocs and so far, I have 3 instances of them.

When I use the 4th one, I get an error.
The error points to my SQL variable which is fine.

If I comment out my first heredoc instance, the script works.
--

print <<<USERSHOW

<html> blah blah</html>

USERSHOW;
 
Yep, heredoc seems to be the unlikely culprit. I can't believe it though. Could there be another reason?

The first print statement works. The heredoc gives me this error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in ...line 96


print "<tr>\n".
"\t<td colspan=\"6\">Open Tickets :</td>\n".
"</tr>\n".
"<tr>".
"\t<td align=\"center\">No.</td>\n".
"\t<td align=\"center\">Subject</td>\n".
"\t<td align=\"center\">Date Submitted</td>\n".
"\t<td align=\"center\">Handler</td>\n".
"</tr>\n";
/*

print <<<THIS

<tr>
<td colspan="6">Open Tickets :</td>
</tr>
<tr>
<td align="center">No.</td>
<td align="center">Subject</td>
<td align="center">Date Submitted</td>
<td align="center">Handler</td>
</tr>


THIS;
*/
 
heres weird, copy and pasted the heredoc code , ran it and got first:
unexpected $ in blah at line 16.

hmm ok.

refreshed the page and got
unencapsulated T_S in line 16

hmm ...
refresh .. ta-da!!! it works .. and I changed ....





nothing.


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
I can't see your script, so I can't comment too precisely. But as a troubleshooting measure, I would comment out the heredocs and see what errors you get.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I have 4 instances of the heredoc syntax in the script.

For this particular instance, the first instance, is the one giving me the problem with the exact code i've posted.

The remaining 3 heredocs work and print the desired text.
There is a SQL statement before each one and those statements work as tested in the PHP script and in MySQLcc.

If I comment out the first heredoc, the script runs fine.

Refreshing doesn't get it to work like KarveR got it to work.
 
This is even crazier.

I just added another heredoc instance and it works.

If I uncomment the first one, it fails.

This works with the other 3 and they're similar.

$i=1;
while($row=mysql_fetch_object($result))
{
$stripslashes = stripslashes($row->subject);

print <<<OPENTICKETS
<tr>
<td align="right">$i&nbsp;</td>
<td>{$stripslashes}</td>
<td title="Date Submitted: {$row->submit_spelled}">$row->submitted</td>
<td align="center">$row->mod_username</td>
</tr>

OPENTICKETS;
$i++;
}
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top