pagination problem

gaurab - November 20, 2008 - 05:11

I am new to drupal ,i have got a problem in the pagination.Hers is my code
drupal_add_css(drupal_get_path('module', 'news') .'/news.css', 'last', 'all', TRUE);
$breadcrumb = array();
$breadcrumb = array(l(t('Home'), ''), l(t('News'), 'client_news'));
drupal_set_breadcrumb($breadcrumb);

$news_content = '';
$limit = 5;
$query = "SELECT * FROM news";
$record_count = db_result(db_query("SELECT COUNT(*) FROM {news}"));
$result = pager_query($query,$limit,0,$record_count);

while($links = db_fetch_object($result)) {

$length_news = strlen(trim($links->news_desc));

if ($length_news > 300) {
$news_desc = substr($links->news_desc, 0, 300). '...';
} else {
$news_desc = $links->news_desc;
}

$status = ($links->is_active == 'Publish')?'Published':'Unpublished';

$news_content .= theme('news_display',
check_plain($links->news_title),
check_plain($news_desc),
l('More','news_detail/view/' . $links->id));
}
$news_content.= theme('pager', NULL,$limit, $record_count);

return $news_content;

not sure where is the problem but 5 records are displayed and the pagination is not displayed and i got the error
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '8' at line 1 query: 8 i

Any suggestions
Thanks

 
 

Drupal is a registered trademark of Dries Buytaert.