Jump to content
Sign in to follow this  
IanArcher

Displaying TV guide listings results via PHP script

Recommended Posts

I'm writing an application using PHP and MySQL that is a TV Guide/TV Listings to pull the results of the following fields:
    id – int(11)    name – varchar(255)    chan_position – int(3)    src_image – varchar(255)    time – varchar(255)    title – varchar(255)    date – varchar(25)
This is the code I've tried so far that basically displays all results as a table:
    <?php    require('db.php');    ?>        <div class="container">    <?    //Start table    echo "<table id='guide'>";    echo "<th>Channel</th>";    echo "<th>Title</th>";    echo "<th>Time</th>";    echo "<th>Date</th>";    echo "</tr>";            // Loop through database    for ($i = 1; $i < $rowcount; $i++) {    $row = mysqli_fetch_assoc($result);    $chan_name = $row['name'];    $chan_num = $row['chan_position'];    $chan_logo = $row['src_image'];    $time = date("g:i a", strtotime($row['time']));    $title = $row['title'];    $date = $row['date'];        // Show entries    echo    "<tr>    <td style='text-align: center;'>"."<img src='".$chan_logo."'><br>".$chan_name."</td>    <td>".$title."</td>    <td>".$time."</td>    <td>".$date."</td>    </tr>";        }        echo "</table>"    ?>
The ultimate goal is to have it display closely (but not exactly) to how its done here: http://www.zap2it.com/tvlistings
1. Getting the pagination to be horizontal and the loop through the results based on the time that is stored in the `time` column from 00:00 to 23:00 (use of AJAX necessary?)
**Additional details**
This is what is currently being output and the link above is what is needed to be output in terms of scrolling and pagination functionality. The output of the table at the moment is how the data is currently stored in the table as well.
iUGu7.png

Share this post


Link to post
Share on other sites

If you are trying to paginate data, then yes something like AJAX would be needed after the initial load if you wanted to load new data without refreshing / reloading the current page.

Share this post


Link to post
Share on other sites

Ok, using this setup or building off of it (because i've never used AJAX before) how would I implement that? If possible, can you provide some coding snippets?

Share this post


Link to post
Share on other sites

You'll need to be familiar with ajax, so I would suggest going through the tutorial. There are some examples there.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...