我有一個分頁腳本,它可以在這裏看到獲取數據: http://www.automotori6282.tk/phpsandbox/分頁腳本從兩個表
這是源代碼:
http://pastebin.com/raw.php?i=63dCvfxD(PmcPagination.php)
http://pastebin.com/raw.php?i=3k4nqwRB (demo.php,帶有代碼的頁面)
and index.php for http://www.automotori6282.tk/phpsandbox/只是使用PHP的include()函數來顯示demo.php
我想要做的是從兩個表中提取分頁。
這是我目前的數據庫結構:
programme varchar(255)
channel varchar(255)
episode varchar(255)
series varchar(255)
setreminder varchar(255)
不過,我存儲在一個單獨的表中的情節,並想使這些來自epdata167和情節表格中抽出查詢(中情節表只有情節,seriesno,episodeno和描述作爲其領域)。我在分頁腳本所做
一個錯誤顯示在這裏:
TV Show showing on Channel 1 August 3rd - 12:30pm "" Set Reminder
TV Show showing on Channel 1 August 3rd - 8:30pm "Episode 1" Set Reminder
,它仍然是事件發生後不久。
這是它應該是如何工作的:
TV Show showing on Channel 1 August 3rd - 12:30pm
TV Show showing on Channel 1 August 3rd - 2:45pm Set Reminder
TV Show showing on Channel 1 August 3rd - 8:30pm "Episode 1" Set Reminder
注意如何當事件發生時設置提醒字段不顯示出來,如果沒有選擇一個小插曲沒有引號。 (setreminder字段基本上是一個鏈接,用戶點擊它可以向他們發送提醒,說「電視節目是在8月3日頻道播放 - 8:30 pm第1集」或「電視節目今天播出8:30 pm第1集「。然而,就不會顯示該現在正確播出的節目,它會顯示如下:
TV Show showing on Channel 1 August 3rd - 12:30pm
)
這是分頁代碼造成麻煩:
$結果= mysql_query( 「SELECT program,channel,airdate,expiration,episode,series,setreminder FROM epdata167 where airdate> curdate()GROUP by airdate」);
,這裏是我編輯嘗試使用ifelse語句,但不知道該怎麼做分頁代碼的一部分:
class paginationData {
private $program;
private $channel;
private $airdate;
private $exiration;
private $episode;
private $series;
private $setReminder;
public function __construct($program, $channel, $airdate, $expiration, $episode, $setReminder)
{
$this->program = $program;
$this->channel = $channel;
$this->airdate = strtotime($airdate);
$this->expiration = $expiration;
$this->episode = $episode;
$this->setReminder = $setReminder;
}
//This function shows the data
public function display()
{
if(date('Y-m-d') == date('Y-m-d', $this->airdate)) $dateFormat = 'g:ia';
elseif(date('Y') == date('Y', $this->airdate)) $dateFormat = 'F jS - g:ia';
else $dateFormat = 'F jS, Y - g:ia';
echo '<tr>'."\n".
' <td><strong>'.$this->program.'</strong></td>'."\n".
' <td>showing on '.$this->channel.'</td>'."\n".
' <td>'.date($dateFormat, $this->airdate).'</td>'."\n".
' <td><b>"'.$this->episode.'"</b><br></td>'. "\n".
' <td>'.$this->setReminder.'</td>'."\n".
'</tr>'."\n";
}
}
基本上,我有麻煩試圖讓我的項目數據,因爲這:
TV Show showing on Channel 1 August 3rd - 12:30pm
TV Show showing on Channel 1 August 3rd - 2:45pm Set Reminder
TV Show showing on Channel 1 August 3rd - 8:30pm "Episode 1"
Series 1, episode 1 Set Reminder
(這就是如果情節是一系列數字系列的一部分)
不知道什麼JOIN使用和在哪裏,所有的幫助表示讚賞試圖讓這個工作,因爲我已經分頁工作;只是想獲得更精細的細節!
我不是要求人們爲我做這件事,我一直在學習我自己,並且完成了我的研究。
對不起,如果這看起來有點長,但我希望我已經解釋了一切。
謝謝。
夥計,這是一個完整的lotta代碼。嘗試將您的問題分解爲一個或多個合理長度的問題。分而治之是你的朋友! – sfussenegger 2010-07-28 12:12:59
我不想將大量垃圾郵件發送到網站,我已經有了分頁工作的基本問題。 – whitstone86 2010-07-28 12:48:02