Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Parse error: syntax error, unexpected end of file in C:\wamp64\www\database\mydb.php on line 55


What I have tried:

<?php
echo "<!DOCTYPE html>";
echo "<html>";
echo "<head>";
echo "<title> Psychiatric disorders database </title>";
echo "<style>";
echo "<table align='center' border='1px' width:'600px' line-height:'40px;'>";
echo "</style>";
echo "</head>";
echo "<body>";


$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mydb";

include("connection.php");

$sql = "SELECT * FROM `schizophrenia raw datasets` ";
if($result = mysqli_query($conn, $sql)){
    
        echo "<table>";
            echo "<tr>";
                echo "<th>Accession ID</th>";
                echo "<th>Title</th>";
                echo "<th>Abstract</th>";
				echo "<th>Sample size</th>";
				echo "<th>Tissue type</th>";
				echo "<th>PMID</th>";
				echo "<th>Platform ID</th>";
				echo "<th>Platform details</th>";
				echo "<th>Raw data</th>";
                echo "</tr>";
        while($row = mysqli_fetch_array($result)){
            echo "<tr>";
                echo "<td>" . $row['Accession ID'] . "</td>";
                echo "<td>" . $row['Title'] . "</td>";
                echo "<td>" . $row['Abstract'] . "</td>";
				echo "<td>" . $row['Sample size'] . "</td>";
				echo "<td>" . $row['Tissue type'] . "</td>";
				echo "<td>" . $row['PMID'] . "</td>";
				echo "<td>" . $row['Platform ID'] . "</td>";
				echo "<td>" . $row['Platform details'] . "</td>";
				echo "<td>" . $row['Raw data'] . "</td>";
				echo "</tr>";
        }
        echo "</table>";
	 
	 
		// Close connection
mysqli_close($conn);
echo "</body>";
echo "</html>";
?>
Posted
Updated 29-Jan-20 19:52pm

You are missing the closing curly bracket from this:
PHP
if($result = mysqli_query($conn, $sql)){
 
Share this answer
 
Comments
Member 14729284 30-Jan-20 1:56am    
Thank you for solution.Now i am getting only connected successfully file but not a table.
OriginalGriff 30-Jan-20 2:07am    
That's a totally different question, and needs to be asked as such: but remember, we can't see your screen or access your DB, so you need to provide much better information than "it don't work"!
After indentation, your code look like:
PHP
<?php
echo "<!DOCTYPE html>";
echo "<html>";
echo "<head>";
echo "<title> Psychiatric disorders database </title>";
echo "<style>";
echo "<table align='center' border='1px' width:'600px' line-height:'40px;'>";
echo "</style>";
echo "</head>";
echo "<body>";


$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mydb";

include("connection.php");

$sql = "SELECT * FROM `schizophrenia raw datasets` ";
if($result = mysqli_query($conn, $sql)){

    echo "<table>";
    echo "<tr>";
    echo "<th>Accession ID</th>";
    echo "<th>Title</th>";
    echo "<th>Abstract</th>";
    echo "<th>Sample size</th>";
    echo "<th>Tissue type</th>";
    echo "<th>PMID</th>";
    echo "<th>Platform ID</th>";
    echo "<th>Platform details</th>";
    echo "<th>Raw data</th>";
    echo "</tr>";
    while($row = mysqli_fetch_array($result)){
        echo "<tr>";
        echo "<td>" . $row['Accession ID'] . "</td>";
        echo "<td>" . $row['Title'] . "</td>";
        echo "<td>" . $row['Abstract'] . "</td>";
        echo "<td>" . $row['Sample size'] . "</td>";
        echo "<td>" . $row['Tissue type'] . "</td>";
        echo "<td>" . $row['PMID'] . "</td>";
        echo "<td>" . $row['Platform ID'] . "</td>";
        echo "<td>" . $row['Platform details'] . "</td>";
        echo "<td>" . $row['Raw data'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";


    // Close connection
    mysqli_close($conn);
    echo "</body>";
    echo "</html>";
    ?>

a } is missing.

Advice: Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.

Indentation style - Wikipedia[^]

Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[^]
ultraedit[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900