Мне удалось реализовать разбиение по страницам без части linq, и соответствующий код таков: (разделен на несколько файлов )
- pagination.php, где все начинается.
Разбивка на страницы с помощью Jquery, Ajax, PHP
Код: Выделить всё
[*]load_data.php, файл, в котором хранятся данные все вытащено [code] $query_pag_data = "SELECT id as msg_id,name as message from student LIMIT $start, $per_page"; $result_pag_data = mysql_query($query_pag_data) or die('MySql Error' . mysql_error()); $msg = ""; while ($row = mysql_fetch_array($result_pag_data)) { $htmlmsg=htmlentities($row['message']); $msg .= "" . $row['msg_id'] . "[/b] " . $htmlmsg . "";[b] } $msg = "[list]" . $msg . "[/list]"; // Content for Data /* --------------------------------------------- */ $query_pag_num = "SELECT COUNT(*) AS count FROM student"; $result_pag_num = mysql_query($query_pag_num); $row = mysql_fetch_array($result_pag_num); $count = $row['count']; $no_of_paginations = ceil($count / $per_page); /* ---------------Calculating the starting and endign values for the loop----------------------------------- */ if ($cur_page >= 7) { $start_loop = $cur_page - 3; if ($no_of_paginations > $cur_page + 3) $end_loop = $cur_page + 3; else if ($cur_page $no_of_paginations - 6) { $start_loop = $no_of_paginations - 6; $end_loop = $no_of_paginations; } else { $end_loop = $no_of_paginations; } } else { $start_loop = 1; if ($no_of_paginations > 7) $end_loop = 7; else $end_loop = $no_of_paginations; } /* ----------------------------------------------------------------------------------------------------------- */ $msg .= "[list]"; // FOR ENABLING THE FIRST BUTTON if ($first_btn && $cur_page > 1) { $msg .= "[*]First"; } else if ($first_btn) { $msg .= "[*]First"; } // FOR ENABLING THE PREVIOUS BUTTON if ($previous_btn && $cur_page > 1) { $pre = $cur_page - 1; $msg .= "[*]Previous"; } else if ($previous_btn) { $msg .= "[*]Previous"; } for ($i = $start_loop; $i Подробнее здесь: [url]https://stackoverflow.com/questions/6368988/how-to-implement-a-basic-php-paging-with-mysql-ajax-and-linq[/url]