-1

I have created a database and different tables in that database. Now when i tries to create a table to display it in browser using html in my php file , its throwing some errors. I am using colspan property in my table. When i am running my php file its showing like "unexpected 2 in line number 16".

<html>   
<head>
</head>
<body>  
<?php
        $servername = "localhost";
        $username = "root";
        $password = "";
        $dbname = "final_database";
        $conn = mysql_connect($servername, $username, $password);
        mysql_select_db("final_database");
        echo "<table border=1>
        <thead>
        <tr>
            <th colspan="2">parametr_1</th> //line number 16
            <th colspan="2">parameter_2</th>
            <th colspan="2">parameter_3</th>
        </tr>
        <tr>
            <th>subhead1</th>
            <th>subhead2</th>
            <th>subhead3</th>
            <th>subhead4</th>
            <th>subhead5</th>
            <th>subhead6</th>
        </tr>";
    echo "<tr>";    
    echo "</table>";
    ?>
    </body>

Akshay
  • 23
  • 6

1 Answers1

2

Try this :

echo "<table border=1>
        <thead>
        <tr>
            <th colspan='2'>parametr_1</th> 
            <th colspan='2'>parameter_2</th>
            <th colspan='2'>parameter_3</th>
        </tr>
        <tr>
            <th>subhead1</th>
            <th>subhead2</th>
            <th>subhead3</th>
            <th>subhead4</th>
            <th>subhead5</th>
            <th>subhead6</th>
        </tr>";
    echo "<tr>";    
    echo "</table>";

Use single quote instead of double.

Happy Coding
  • 2,517
  • 1
  • 13
  • 24