0

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:
81ed4627bf49a59e5e215b52917d0eeb

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?

coding:

<div style="width:600px; margin-left:200px;float:left;">
    <table id='currevents' border='2' rules='all' cellspacing='5px' cellpadding='5px'>
        <thead>
            <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>
            </tr>
        </thead>
        <tbody>
<?php

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

            while($row=mysql_fetch_array($result)){
            $name=$row['event_name'];
            $type=$row['event_type'];
            $date=$row['event_date'];
            $time=$row['event_time'];
            $venue=$row['event_venue'];

            echo "<tr>
                <td>.$name.</td><td>.$type.</td><td>.$date.</td><td>.$time.</td><td>.$venue.</td>
            </tr>";

            }   
?>
        </tbody>
    </table>
</div>
Attachments ems2.jpg 65.36 KB
3
Contributors
3
Replies
28
Views
3 Years
Discussion Span
Last Post by nadiam
0

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

This question has already been answered. 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.