-1

I am just starting to learn PHP and I get this weird error when trying to run my php script:

Parse error: syntax error, unexpected '<' in /-snip-/Account/Register.php on line 9

It is weird because my line 9 is <h1>Login</h1> and there is no syntax error. Here is my full script:

<?php

$connection = mysql_connect("-snip-", "-snip-", "-snip-") or die("Could not connect to the Lunar Servers! Please try again later...");
mysql_select_db("-snip-", $connection) or die("Could not connect to the Lunar DB! Please try again later...");

echo "
    <body style='font-family: verdana, sans-serif;'>    
        <div style='width: 80%; padding: 10px; border: 1px solid #e3e3e3; background-color: #fff; color: #000";
            <h1>Login</h1>
        </div>
    </body>
";

It should connect to my MySQL Database and then display "Login" with a light gray border around it. Sadly, I recieve that error instead and I do not know why.

Thanks in advance :)

3 Answers3

3

The line above it is missing > and has a " that ends the echo body, so the < is unexpected.

ZachB
  • 13,051
  • 4
  • 61
  • 89
3

Issue is here

<div style='width: 80%; padding: 10px; border: 1px solid #e3e3e3; background-color: #fff; color: #000";

You have incorrect opening-closing quotes for the style tag as well as div tag not closing

<div style='width: 80%; padding: 10px; border: 1px solid #e3e3e3; background-color: #fff; color: #000;'>

try replacing with something like the above

Gayan Hewa
  • 2,277
  • 4
  • 22
  • 41
1

The issue is with this line of code:

<div style='width: 80%; padding: 10px; border: 1px solid #e3e3e3; background-color: #fff; color: #000";

You open it with ' and close it with " - try changing it to this:

<div style='width: 80%; padding: 10px; border: 1px solid #e3e3e3; background-color: #fff; color: #000';
The Codesee
  • 3,714
  • 5
  • 38
  • 78