Displaying file on localhost

Hello - I’m learning php using the excellent Quick Programming videos on Youtube, but they don’t have a troubleshoot function. I have the following error message when trying to display a file on the browser:

Parse error: syntax error, unexpected variable “$host” in C:\xampp\htdocs\Training\Connect.php on line 9.

I’ve not had this before. Any ideas on how I can solve it?

Syntax errors mean that the language engine found something that it couldn’t understand in the current context, usually do to something missing prior to the point where the error is being reported.

The way to solve this is to actually learn the meaning of the words and syntax of the language you are using, and to proofread the code to find what is being misused.

If you cannot determine what is causing the error, you will need to post at least 10 lines (or in this case all) of the code up to and including the line where the error is being reported. Redact any database connection credentials.

Thanks. Your reply has helped me to look more carefully at the page and I’ve now solved the problem.

Sponsor our Newsletter | Privacy Policy | Terms of Service