Welcome to WebmasterWorld Guest from 23.20.193.33

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php problem.

a newby question.

     
6:22 pm on Oct 29, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 18, 2002
posts:638
votes: 0


hello, i'm new with php.
i'm having trouble and hope you guys can help me.

The line:
echo "<title>"$sub;".bestevanhetnet.nl</title>";

the error:
Parse error: parse error, expecting `','' or `';'' in /usr/local/slash/apache/vhosts/bestevanhetnet.nl/httpdocs/test/test-header.php on line 8

what am i dooing wrong? shou;d i use the 'subpage' variable instead? or is it a obvous problem?

i don't want to programm a lot php, i just need this line.

6:28 pm on Oct 29, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2002
posts:121
votes: 0


ikbenhet1,

It is probably the semicolon (;) behind $sub. Just remove it. You should also change add . to the second and third ":

echo "<title>".$sub.".yourserver.nl</title>";

NN

[edited by: NameNick at 6:31 pm (utc) on Oct. 29, 2002]

6:30 pm on Oct 29, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 29, 2002
posts:356
votes: 0


I'm not quite clear what you are trying to echo, but the syntax looks incorrect! How about:

echo "<title>" . $sub . ".bestevanhetnet.nl</title>";

If not, give me an example of what you require to be output!

6:30 pm on Oct 29, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:May 2, 2002
posts:141
votes: 0


echo "<title>"$sub;".title</title>";

I- echo "<title>".$sub."title</title>";
II- echo "<title>$sub title</title>";

When you use quotes to echo a string, you have to concatenate (?) the next quotes or variables with a period, like in example I.
Another way is putting the variable inside the quotes, like in example II. Although sometimes, you can't or shouldn't put a variable inside quotes.

6:30 pm on Oct 29, 2002 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


just slap another dot in there

echo "<title>".$sub.".bestevanhetnet.nl</title>";

7:10 pm on Oct 29, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


echo "<title>", $sub, ".bestevanhetnet.nl</title>";

might be more efficient.

Andreas

11:47 pm on Oct 29, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Apr 4, 2002
posts:236
votes: 0


<html>
<head>
<title><? echo $sub ?>.bestevanhetnet.nl</title>
</head>

Yet another way of doing it. :o

4:32 pm on Nov 9, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 15, 2002
posts:971
votes: 0


echo "<title>", $sub, ".bestevanhetnet.nl</title>";

might be more efficient.

Why commas instead of a period? Not sure I understand that.

I can see:

echo "<title>" . $sub . ".bestevanhetnet.nl</title>";

6:13 pm on Nov 9, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 12, 2002
posts:885
votes: 0


Why commas instead of a period? Not sure I understand that.

With commas, it's a list of arguments to 'echo'. With periods, the argument to 'echo' is a single string, which is the result of multiple string concatenations. The end result is the same, but the list of arguments is processed more efficiently.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members