anyone can help me? why my website like this…
Exactly what it says in the error message. You have an unexpected closing bracket in your code. Usually, but not always, this means you are missing a semicolon on the line before.
<?php
// isi nama host, username mysql, dan password mysql anda
$myHost = "xxxxx";
$myUser = "xxxxxx";
$myPass = "xxxxx";
$myDbs = "xxxxx";
$conn = mysqli_connect( $myHost, $myUser, $myPass, $myDbs);
if(!$conn){
echo "gagal konek database menn";
} else {
}
?>
Can you tell me which part is wrong?
You have an empty else statement
can you help me to fix it?
No, I’m not going to fix one of the most simplest PHP errors for you, especially since I already told you exactly what is causing it.
If you want to have a website, your going to have to learn how to debug it and fix it when errors occur, why not start now when it’s easy?
If you have a specific question, we’ll be more than happy to help you out, but we’re not going to actually do anything for you.
We can help you fix it, but please understand that we’re here to help us use our hosting, we’re not here to teach you the basics of PHP coding. You can’t just throw broken, invalid code at our servers and expect us to make it work for you.
@Greenreader9 already told you what the issue was: the else block is empty. That’s not allowed in PHP.
Right now, if the if statement on line 9 is true, it prints some text on line 10. But if it’s not true, it goes to the else
block, but there is no code. If you don’t want anything to happen there, don’t have an else block. And if you do want something to happen, then put that code in there (or at least put some placeholder there to satisfy the compiler and verify that the code is reached).
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.