Hi, I seem to be having this problem with my programming. I have tried many ways to solve this issue, the web page was working previously but when i imported into my new localhost from my now shutting down web server, it kept telling me this error.
Parse error: syntax error, unexpected $end on line ______

the only thing that is common here is the database configuration file. Which is below, could someone enlighten me as to where i am going wrong?

<?php
function dbConnect()
{
$host = "bit-mp.tp.edu.sg";
$username="mp01";
$password="nick86a";
$database = "mp01";

$conn = mysql_connect($host,$username,$password);
$select = mysql_select_db($database, $conn);

return $conn;
}

function dbDisconnect($myConn)
{
mysql_close($myConn);
}
?>
Member Avatar for diafol

these messages are often due to unclosed braces '}'. If you indent your code properly, these are usually pretty easy to pick up.

function dbConnect(){
    $host = "bit-mp.tp.edu.sg";
    $username="mp01";
    $password="nick86a"; 
    $database = "mp01";
    $conn = mysql_connect($host,$username,$password);
    $select = mysql_select_db($database, $conn);
    return $conn;
}
 
function dbDisconnect($myConn){
    mysql_close($myConn);
}

From checking your code, it seems fine, unless I've missed something really obvious. These errors could be due to a missing brace well before the end of the page. Checking nested braces is therefore much easier with indented code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.