Can some one help me with this code? I need some modification..
this is a working search result code.. the problem is the display part.. when the search results were found it will display example 10 rows in a page but it has no break..
the number page is shown like this.
[1] [2] [3] [4] [5] [6] ...
it will continue to go until no end if the results are huge.
I need a previous and next option, each page only display 1 - 10.
look like this:
<< previous [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] Next >>>
Can some one help me?
Another problem is I can't display the message that there is no result found.. really cause me headache.
here is my code:
<?
require ("config.php") ;
if (!IsSet($page))
{
$page=1 ;
}
$start_num = ($page-1)* $ads_pro_page ;
$end_num = $start_num + $ads_pro_page ;
if ($work=="1")
$work2="" ;
else
$work2="work='".$work."'" ;
$stampmebaby =getdate(time()) ;
$day= $stampmebaby[mday] ;
$month=$stampmebaby[mon] ;
$year=$stampmebaby[year] ;
$year1=$year-$Age1 ;
$year2=$year-$Age2 ;
$checkage="(( bday<='$day' AND bmonth<='$month' AND byear='$year1' ) OR ( byear<'$year1' )) AND (( bday<='$day' AND bmonth<='$month' AND byear='$year2' ) OR ( byear>'$year2' ))" ;
include ("config.php") ;
$query="SELECT * FROM money WHERE ".$checkage." ".$where." order by ID desc" ;
$result = mysql_query($query)
or die(mysql_error());
$n = 1 ;
while ($row = mysql_fetch_array($result) )
{
$stampmebaby =getdate(time()) ;
$day= $stampmebaby[mday] ;
$month=$stampmebaby[mon] ;
$year=$stampmebaby[year] ;
$age_year= $year-$row[byear] ;
$age=$age_year ;
if ($month>=$row[bmonth] AND $day>=$row[bday])
$age=$age_year ;
else
$age=$age_year-1 ;
if ( $n>$start_num and $n<=$end_num)
{
?>
My Work Search results: <? echo $row[10]; ?>
<?
}
else
{
echo("Sorry, no results") ; // This pasrt cannot be display if no result.. I do not know why???? PLease help
}
$n = $n + 1 ;
}
echo ("<table>");
$total_records = mysql_num_rows($result) ;
$number_pages = 1 + $total_records / $ads_pro_page ;
$aarrgghh1=urlencode($Age1);
$aarrgghh2=urlencode($Age2);
$aarrgghh=urlencode($country);
echo ("<tr>");
$c = 1 ;
while ($c <= $number_pages)
{
echo ("<TD WIDTH=\"20,\" ALIGN=\"LEFT\"><a HREF=\"$PHP_SELF?Age1=$aarrgghh1&Age2=$Age2&work=$aarrgghh&page=$c\">$c</a></td>") ;
$c = $c + 1 ;
}
echo ("</tr></TABLE>") ;
?>
Million thanks to those that help.