Hello
I try to make pagination to a site and i get the error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\xampp\htdocs\site-functions.php on line 128
The php code is
if (defined('EXTERNAL')){}
else{echo 'Restricted Access.';exit;}
[COLOR="Red"]function showPages()
{
global $pager;
global $section;
global $page;
global $action;
if ((!$action=='single' && $section=='news') || ($section=='guestbook' && !$action=='newentry'))
{
echo "<br/><div align='center' style='color:#FFFFFF;a:link{#FFFFFF}'><img src='files/images/layout/page.png' alt='page' border='0' /> Σελίδα: ".$page." από ".$pager->max_pages." <br/><br/><br/>".$pager->show_pages()."</div><br/>";
}
}[/COLOR]
/* News & Events */
function showHomeArticles()
{
$show_articles_query = "SELECT * FROM vrcs_articles WHERE row_category='0' AND row_visible='1' ORDER BY row_order ASC LIMIT 3";
$show_articles_result = mysql_query($show_articles_query) or die('Error: ' . mysql_error());
while($row = mysql_fetch_array($show_articles_result))
{
$get_article_id=$row['row_id'];
$get_article_title=$row['row_title'];
$get_article_content=$row['row_content'];
$get_article_publish_date=$row['row_publish_date'];
$get_thumbnail=$row['row_thumbnail'];
if ($get_thumbnail==''){$get_thumbnail='default.png';}
$get_article_content=summarize($get_article_content,100,true);
//format date
$date_array = explode("-", $get_article_publish_date);
$get_year=$date_array[0];
$get_month=$date_array[1];
$get_day=$date_array[2];
switch ($date_array[1])
{
case '1':
$current_month_txt='Ιανουαρίου';
break;
case '2':
$current_month_txt='Φεβρουαρίου';
break;
case '3':
$current_month_txt='Μαρτίου';
break;
case '4':
$current_month_txt='Απριλίου';
break;
case '5':
$current_month_txt='Μαϊου';
break;
case '6':
$current_month_txt='Ιουνίου';
break;
case '7':
$current_month_txt='Ιουλίου';
break;
case '8':
$current_month_txt='Αυγούστου';
break;
case '9':
$current_month_txt='Σεπτεμβρίου';
break;
case '10':
$current_month_txt='Οκτωβρίου';
break;
case '11':
$current_month_txt='Νοεμβρίου';
break;
case '12':
$current_month_txt='Δεκεμβρίου';
break;
default:
}
echo "<br/>
<div style='clear:both'>
<div style='float:left'><img src='uploads/images/thumbnails/$get_thumbnail' alt='$get_article_title' style='padding:5px;' />
</div>
<div style='font-size:11px'>
<div style='height:22px;overflow:hidden;'>
<strong>$get_article_title</strong><br/>
</div>
<p style='color:red;padding-top:6px;padding-bottom:6px'>$get_day $current_month_txt $get_year</p>
$get_article_content<br/><br/>
<a href='index.php?section=news&action=details&id=$get_article_id'><img src='files/images/more.png' id='more$get_article_id' alt='$get_article_title' onmouseover=\"document.more$get_article_id.src='files/images/more-rollover.png'\" onmouseout=\"document.more$get_article_id.src='files/images/more.png'\" /></a>
</div>
</div>
";
}
}
function showArticles()
{
global $pager;
$show_articles_query = "SELECT * FROM vrcs_articles WHERE row_category='0' AND row_visible='1' ORDER BY row_publish_date DESC, row_publish_time DESC ";
$show_articles_result = mysql_query($show_articles_query) or die('Error: ' . mysql_error());
while($row = mysql_fetch_array($show_articles_result))
{
$get_article_id=$row['row_id'];
$get_article_title=$row['row_title'];
$get_article_content=$row['row_content'];
$get_article_publish_date=$row['row_publish_date'];
$get_thumbnail=$row['row_thumbnail'];
if ($get_thumbnail==''){$get_thumbnail='default.png';}
$get_article_content=summarize($get_article_content,100,true);
[COLOR="Red"]$pager = new sql_pagination($db_connection,$show_articles_query,4,5);
$show_articles_result = $pager->paginate_query(); [/COLOR]
//format date
$date_array = explode("-", $get_article_publish_date);
$get_year=$date_array[0];
$get_month=$date_array[1];
$get_day=$date_array[2];
switch ($date_array[1])
{
case '1':
$current_month_txt='Ιανουαρίου';
break;
case '2':
$current_month_txt='Φεβρουαρίου';
break;
case '3':
$current_month_txt='Μαρτίου';
break;
case '4':
$current_month_txt='Απριλίου';
break;
case '5':
$current_month_txt='Μαϊου';
break;
case '6':
$current_month_txt='Ιουνίου';
break;
case '7':
$current_month_txt='Ιουλίου';
break;
case '8':
$current_month_txt='Αυγούστου';
break;
case '9':
$current_month_txt='Σεπτεμβρίου';
break;
case '10':
$current_month_txt='Οκτωβρίου';
break;
case '11':
$current_month_txt='Νοεμβρίου';
break;
case '12':
$current_month_txt='Δεκεμβρίου';
break;
default:
}
echo "<br/>
<div style='clear:both'>
<div style='float:left'><img src='uploads/images/thumbnails/$get_thumbnail' alt='$get_article_title' style='padding:5px;' />
</div>
<div style='font-size:11px'>
<div style='height:22px;overflow:hidden;'>
<strong>$get_article_title</strong><br/>
</div>
<p style='color:red;padding-top:6px;padding-bottom:6px'>$get_day $current_month_txt $get_year</p>
$get_article_content<br/><br/>
<a href='index.php?section=news&action=details&id=$get_article_id'><img src='files/images/more.png' id='more$get_article_id' alt='$get_article_title' onmouseover=\"document.more$get_article_id.src='files/images/more-rollover.png'\" onmouseout=\"document.more$get_article_id.src='files/images/more.png'\" /></a>
</div>
</div>
";
}
}
The pagination code is in red
Because i'm realy a newbie can you help me ??????