homepage Welcome to WebmasterWorld Guest from 54.167.179.48
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
php problem.
a newby question.
ikbenhet1

10+ Year Member



 
Msg#: 1065 posted 6:22 pm on Oct 29, 2002 (gmt 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.

 

NameNick

10+ Year Member



 
Msg#: 1065 posted 6:28 pm on Oct 29, 2002 (gmt 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]

shady

10+ Year Member



 
Msg#: 1065 posted 6:30 pm on Oct 29, 2002 (gmt 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!

transistor

10+ Year Member



 
Msg#: 1065 posted 6:30 pm on Oct 29, 2002 (gmt 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.

jatar_k

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



 
Msg#: 1065 posted 6:30 pm on Oct 29, 2002 (gmt 0)

just slap another dot in there

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

andreasfriedrich

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 1065 posted 7:10 pm on Oct 29, 2002 (gmt 0)

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

might be more efficient.

Andreas

dhdweb

10+ Year Member



 
Msg#: 1065 posted 11:47 pm on Oct 29, 2002 (gmt 0)

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

Yet another way of doing it. :o

madcat

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 1065 posted 4:32 pm on Nov 9, 2002 (gmt 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>";

dingman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 1065 posted 6:13 pm on Nov 9, 2002 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved