IanArcher Posted June 23, 2015 Share Posted June 23, 2015 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. Link to comment Share on other sites More sharing options...
thescientist Posted June 23, 2015 Share Posted June 23, 2015 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. Link to comment Share on other sites More sharing options...
IanArcher Posted June 23, 2015 Author Share Posted June 23, 2015 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? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 23, 2015 Share Posted June 23, 2015 You'll need to be familiar with ajax, so I would suggest going through the tutorial. There are some examples there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now