homepage Welcome to WebmasterWorld Guest from 174.129.80.166
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
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




msg:1269017
 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




msg:1269018
 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




msg:1269019
 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




msg:1269020
 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




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

just slap another dot in there

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

andreasfriedrich




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

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

might be more efficient.

Andreas

dhdweb




msg:1269023
 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




msg:1269024
 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




msg:1269025
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved