HEREDOC help, going quietly nuts

HEREDOC help, going quietly nuts

am 20.10.2007 17:44:48 von NerdRevenge

with this code:
------------------------------------------
$sql = "select * from do_be_do where do_be_id = '$GET[id]'
limit 1";
$result = mysql_query($sql, $connection) or die (mysql_error());
$row = mysql_fetch_array ($result);

$title = stripslashes($row['title']);
$depends = stripslashes($row['depends']);

$detail<<


....
eoxd;
----------------------------
(the elipses (...) represent code left out of the posting

I get the compile error:
Parse error: syntax error, unexpected T_START_HEREDOC in ....at
line 54.

line 54 is the line after: $detail<<
I can't see an error. If I put an echo statement just before the
heredoc there is no compile error, so I presume that the script
is ok up to that place.

Anyone see the error or have suggestions what to look at next ?

bill

Re: HEREDOC help, going quietly nuts

am 20.10.2007 18:35:21 von Jake Barnes

On Oct 20, 11:44 am, bill wrote:
> with this code:
> $title = stripslashes($row['title']);
> $depends = stripslashes($row['depends']);
>
> $detail<< >
> ...
> eoxd;
> ----------------------------
> (the elipses (...) represent code left out of the posting
>
> I get the compile error:
> Parse error: syntax error, unexpected T_START_HEREDOC in ....at
> line 54.
>
> line 54 is the line after: $detail<< >
> I can't see an error. If I put an echo statement just before the
> heredoc there is no compile error, so I presume that the script
> is ok up to that place.


Don't you need an equal sign?



$detail = <<

Re: HEREDOC help, going quietly nuts

am 20.10.2007 19:06:10 von luiheidsgoeroe

On Sat, 20 Oct 2007 17:44:48 +0200, bill wrote:

> with this code:
> ------------------------------------------
> $sql =3D "select * from do_be_do where do_be_id =3D '$GET[id]' limi=
t 1";
> $result =3D mysql_query($sql, $connection) or die (mysql_error());
> $row =3D mysql_fetch_array ($result);
> =

> $title =3D stripslashes($row['title']);
> $depends =3D stripslashes($row['depends']);
>
> $detail<< >
> ...
> eoxd;
> ----------------------------
> (the elipses (...) represent code left out of the posting
>
> I get the compile error:
> Parse error: syntax error, unexpected T_START_HEREDOC in ....at line 5=
4.
>
> line 54 is the line after: $detail<< >
> I can't see an error.

Think of heredoc as alternative quotes

What would the error be in:
$detail 'foo';
-- =

Rik Wasmus

Re: HEREDOC help, going quietly nuts

am 20.10.2007 20:36:54 von NerdRevenge

Rik Wasmus wrote:
> On Sat, 20 Oct 2007 17:44:48 +0200, bill wrote:
>
>> with this code:
>> ------------------------------------------
>> $sql = "select * from do_be_do where do_be_id = '$GET[id]' limit 1";
>> $result = mysql_query($sql, $connection) or die (mysql_error());
>> $row = mysql_fetch_array ($result);
>>
>> $title = stripslashes($row['title']);
>> $depends = stripslashes($row['depends']);
>>
>> $detail<< >>
>> ...
>> eoxd;
>> ----------------------------
>> (the elipses (...) represent code left out of the posting
>>
>> I get the compile error:
>> Parse error: syntax error, unexpected T_START_HEREDOC in ....at line 54.
>>
>> line 54 is the line after: $detail<< >>
>> I can't see an error.
>
> Think of heredoc as alternative quotes
>
> What would the error be in:
> $detail 'foo';

yup, just needed the = sign.

Thanks all - I have been looking at this code too long !

bill