# Solved: php: unexpected $end



## twmprys (Jun 4, 2009)

I'm getting "Parse error: syntax error, unexpected $end in... on line 14" in the following php script - never had this before - is it because it's a different generation of php?:


```
<?php
 mysql_connect("host", "user", "password");
    mysql_select_db("database");
	 $submit = $_POST["form"]; 
if (isset($submit)) {
    $query ="INSERT INTO users (name,email,contact,username)";
    $query.=" VALUES ('$name','$email','$contact','$username')";
    $result=mysql_query($query);

?>

 <
[/TD]
```


----------



## Big-K (Nov 22, 2003)

unexpected end is always caused by missing end parenthesis or brackets, or sometimes a line not terminated with a semicolon.

In your case, you start a bracket set with 'if (isset($submit)) { ' and never end the bracket, so you'll need to end it somewhere. If it ends after the query, just put } after you set $result. If the form code is included in the if block, put <?php } ?> after it.


----------



## twmprys (Jun 4, 2009)

Ah, of course. Thanks very much.


----------

