hey guys so basically what i want to do is populate a table with details from a database. That is part of the problem. When i write the php coding to do that the other elements on the webpage sort of disappear. Ill attach some screenshots to make it clearer.

without the php coding:

with coding:

also the database is currently empty coz im just testing the coding and i was wondering since the database is empty is there a way so that "no database selected" is not shown when the table is empty?


<div style="width:600px; margin-left:200px;float:left;">
    <table id='currevents' border='2' rules='all' cellspacing='5px' cellpadding='5px'>
            <tr align='left'>
                <td width='50px'>Event</td>
                <td width='50px'>Type</td>
                <td width='50px'>Date</td>
                <td width='50px'>Time</td>
                <td width='50px'>Venue</td>

            $sql="SELECT * FROM event";
            $result=mysql_query($sql) or die(mysql_error());


            echo "<tr>


I think the 'no database selected' is caused by your code. Do you have a mysql_select_db() somewhere?

Share the PHP script that you are using to connect to the database.

sorry guys i figured it out. It has to do with this js plugin im using, datatables.

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.