0

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);
}
?>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by diafol
0

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.

Edited by diafol: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.