« Show #53: PHP course begins - Week 1 - Lesson #1a
Show #54: Stringing together PHP »


Trying to write code and getting errors

Posted by Jowlstar on Oct 14, 2005

Alright so im writing code and I go to upload it and I get a parse error that says

Parse error: parse error, unexpected T_VARIABLE in /web/sites/tdavid/webmastercookbook.com/courses/php101/jowl/1b1.php on line 7.

I’m unsure of what a T variable is so can anyone help me, I looked at my line 7 and don’t see any errors, here is line 7:

PHP:

1 
2 $my_favorite_website= ‘<a href="http://www.orting.com/">Orting</a>’;
3 

Both spawn and I have run into the same problem and we have also had many errors but have worked through them, I will ask ChefTD about a T variable later on in the show today.

I fixed it by changing my code to this, i figured out i was missing a closing tag.

PHP:

1 
2 print$my_favorite_website= ‘<a href="http://www.orting.com/">Orting</a>’;
3 

Update 1:15pm PST: I just learned that I was not suppose to put a print out in front of the dollar sign and that the code up there is still wrong. (from ChefTD: Yes, you can put print in front of the $string, but you were trying to print and then assign at the same time, which is not what you wanted to do.)

Update 1:20pm PST: (from ChefTD) Jowl, here is what you want to do:

PHP:

1 
2 $my_favorite_website= ‘<a href="http://www.orting.com/">Orting</a>’;
3 echo($my_favorite_website);
4 

4 Comments »

Jowl - There is a list of parser error tokens at http://us3.php.net/tokens in the php manual.

As you can see your error states “unexpected T_VARIABLE … line 7″

This tells you you have an error assigning the data variable. The example you posted doesn’t seem to contain an error that I can see. However, I could not get your solution to work.

You may want to try something like this:
Orting’;

print(”$my_favorite_website”);
?>

October 14th, 2005 | 12:12 pm

That code got munged. I’m not quite sure why. Do your comments support the [code][/code] tags?

October 14th, 2005 | 12:14 pm
Jowl:

I tried using the print function but did it wrong and should of used the echo function.

October 14th, 2005 | 12:26 pm

Jowl,

In the last installment of WebmasterCookbook, you seemed to be preoccupied - like your mind was on something else. This was comming across really bad & I could hear the frustration build in ChefTD as the show progressed. I kept waiting for you to say “woof woof” every time ChefTD said speak speak! You are quite capable of focusing upon the current task during show time, but for some reason you allow other things to distract you. Now recall the day when you engineered ChefTD’s other show, your voice was strong - full of excitement & you pulled off a great job! Now I’m sure that you do realize the importance of developing programming skills & how that may benefit you in a number of ways throughout your life - especially the problem solving aspect, because lets face it, everybody encounters problems. May I suggest that you try taking a more active role in the show production by becomming the engineer, because you do that well. I know that as a teen it is often difficult to stay focused or to even think about & plan for the future, but it is to your benefit to do so. Think of the things that interest you…take gaming for instance, would you like to develop games? If so, programming skills are an essential part of game development, so approach your programming education with that or any other interest in mind & it will help you through those dry listliss areas of learning to program. You can do this & I am fully confident in that! I do hope to hear the exuberant engineer Jowl on the upcoming show. Hang in there Jowl, I’m pulling for you!

October 25th, 2005 | 3:59 pm
Leave a Reply

Comment