0

HI getting an error Parse error: syntax error, unexpected $end in /home/crafru/public_html/test/damienform.php on line 124

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-gb" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<style type="text/css">
.table-style1 {
    border: 1px solid #000000;
    width: 39%;
    height: 197px;
}
.table-style2 {
    border: 1px solid #000000;
    text-align: center;
    font-weight: bold;
    height: 25px;
}
.table-style3 {
    border: 1px solid #000000;
    text-align: center;
    font-weight: bold;
    width: 221px;
    height: 25px;
}
.table-style4 {
    border: 1px solid #000000;
    width: 221px;
    height: 25px;
}
.table-style5 {
    height: 25px;
    border: 1px solid #000000;
}
</style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; background-color: #EBF4FB">
<?php
    $submitrunnertime= $_POST['submitrunnertime'];
    $RunnerID= $_POST['RunnerID'];
    $EventID= $_POST['EventID'];
    $Date= $_POST['Date'];
    $Time= $_POST['Time'];
    $Position= $_POST['Position'];
    $CategoryID= $_POST['CategoryID'];
    $AgeGrade= $_POST['AgeGrade'];
    $PB= $_POST['PB'];
    $submitrunnertime= $_POST['submitrunnertime'];
    $Test = "pass";

    $host= 'localhost';
    $user= '****';  
    $password= '****';
    $database= '****';

/**
    Function: connect to a database.
    $host = hostname to connect to e.g. 'localhost'
    $id = username identity, e.g. 'ta589'
    $pwd = user password, e.g. 'twiggy9'
    $db = database to use, e.g. 'ta589'
    Returns the database connection.
**/

function connect_db($host, $user, $password, $database) {
    $connection = @mysql_connect($host, $id, $pwd)
        or die('connection problem:' . mysql_error());
    mysql_select_db($db)
        or die('db selection problem:' . mysql_error());
    return $connection;
?>

<table class="table-style1" cellpadding="0" cellspacing="0">
    <tr>
        <td class="table-style3">Feild</td>
        <td class="table-style2">Value</td>
    </tr>
    <tr>
        <td class="table-style4">Runner ID </td>
        <td class="table-style5"><?=$RunnerID?></td>
    </tr>
    <tr>
        <td class="table-style4">Event ID </td>
        <td class="table-style5"><?=$EventID?></td>
    </tr>
    <tr>
        <td class="table-style4">Date </td>
        <td class="table-style5"><?=$Date?></td>
    </tr>
    <tr>
        <td class="table-style4">Time </td>
        <td class="table-style5"><?=$Time?></td>
    </tr>
    <tr>
        <td class="table-style4">Position </td>
        <td class="table-style5"><?=$Position?></td>
    </tr>
    <tr>
        <td class="table-style4">Category ID </td>
        <td class="table-style5"><?=$CategoryID?></td>
    </tr>
    <tr>
        <td class="table-style4">Age Grade </td>
        <td class="table-style5"><?=$AgeGrade?></td>
    </tr>
    <tr>
        <td class="table-style4">PB </td>
        <td class="table-style5"><?=$PB?></td>
    </tr>
    <tr>
        <td class="table-style4">submitrunnertime </td>
        <td class="table-style5"><?=$submitrunnertime?></td>
    </tr>
    <tr>
        <td class="table-style4">Test - Remove this</td>
        <td class="table-style5"><?=$Test?></td>
    </tr>
</table>
</body>
</html>

Been looking at this and can't see any missing end bits. What am i missing?

6
  • 3
    It may not help answer your question, but you should stop using mysql_* functions. They're being deprecated. Instead use PDO (supported as of PHP 5.1) or mysqli (supported as of PHP 4.1). If you're not sure which one to use, read this article. Commented Aug 20, 2012 at 14:54
  • 1
    It a very simple error, My advice is use an IDE like ZendStudio or Netbeans .. you would easily spot such error. The error occurred becasue of missing } in your connect_db() Commented Aug 20, 2012 at 14:56
  • @Baba Actually, in this case NetBeans didn't indicate an error (for me, at least); the formatting was a little off, but no red underlines or other error indicators. Commented Aug 20, 2012 at 14:58
  • what version are you using @Matt Commented Aug 20, 2012 at 14:58
  • @Baba disregard; error indicator is on the last line. Commented Aug 20, 2012 at 15:00

1 Answer 1

4

You're missing a closing 'stache on your function.

function connect_db($host, $user, $password, $database) {
    $connection = @mysql_connect($host, $id, $pwd)
      or die('connection problem:' . mysql_error());
    mysql_select_db($db)
      or die('db selection problem:' . mysql_error());
    return $connection;
} //<--THAT ONE

?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.