This is my pagination script:
<?php
/***********************************
* PhpMyCoder Paginator *
* Created By PhpMyCoder *
* 2010 PhpMyCoder *
* ------------------------------- *
* You may use this code as long *
* as this notice stays intact and *
* the proper credit is given to *
* the author. *
***********************************/
?>
<head>
<title> Pagination Test - Created By PhpMyCoder</title>
<style type="text/css">
#nav { font: normal 13px/14px Arial, Helvetica, sans-serif; margin: 2px 0; }
#nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; }
#nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; }
#nav span { background: #FFF; border: 1px solid #DDD; color: #999; padding: 1px 7px; }
</style>
</head>
<?php
//Require the file that contains the required classes
include("pmcPagination.php");
//PhpMyCoder Paginator
$paginator = new pmcPagination(20, "page");
//Connect to the database
mysql_connect("localhost","root","PASSWORD");
//Select DB
mysql_select_db("tvguide");
//Select only results for today and future
$result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder FROM epdata1 where airdate >= now() order by expiration GROUP BY airdate");
//You can also add reuslts to paginate here
mysql_data_seek($queryresult,0) ;
while($row = mysql_fetch_array($result))
{
$paginator->add(new paginationData($row['programme'],
$row['channel'],
$row['airdate'],
$row['expiration'],
$row['episode'],
$row['setreminder']));
}
?>
<?php
//Show the paginated results
$paginator->paginate ();
?><? include("pca-footer1.php"); ?>
<?php
//Show the navigation
$paginator->navigation();
?>
However, I have two tables in this, and they are epdata1 (where the airtimes for my show House M.D. are) and housemdep plus the setreminder table.
How can I use foreign keys in relation to this? I'm not sure if this will work for my script, but am willing to try.
What I would like to do is to select certain episodes from the table housemdep
(episodes of the show) and if any are selected it shows them as this:
House M.D. showing on Channel 1 June 6th - 8:00pm "Wilson" Set Reminder
House M.D. showing on Channel 1 June 7th - 1:30am "Wilson" Set Reminder
House M.D. showing on Channel 1 June 7th - 12:55pm "House's Head" Set Reminder
or like this, if I have not selected an episode from the row:
House M.D. showing on Channel 1 June 7th - 8:00pm "House's Head" Set Reminder
House M.D. showing on Channel 1 June 8th - 9:00pm Set Reminder
House M.D. showing on Channel 1 June 9th - 2:30pm Set Reminder
House M.D. showing on Channel 1 June 7th - 8:00pm "Que Sera Sera" Set Reminder
Foreign keys and relationship of interlinked tables are new to me, if anyone could help I'd appreciate this.
I've tried some of what Google suggested on foreign keys in another version of this script (this is a clone of the original on my localhost server running Apache and PHP 5.28/MySQL), but am not sure how to implement this.
Thanks.