Page 1 of 1

Reaped Region Problem

Posted: Mon Aug 23, 2010 9:05 am
by spacemoc
Dear Users,

I am getting a problem with Repeating Region for example 4 times and then create next page button to view the other records. Code listed below. When I am trying to apply Repeat Region it's just doesnt work

function executeRow($query__ER,$type=null) {
$result__ER = mysql_query($query__ER) or die ("Error in query: $query__ER. " . mysql_error());
if($result__ER != 1) {
if($type!="array") {
$row__ER = mysql_fetch_object($result__ER);
} else {
$row__ER = mysql_fetch_assoc($result__ER);
}
return $row__ER;
}
}

######################################################
# Connects to the database and returns the
# results in an array
######################################################

function executeQuery($query,$func=null,$type="") {

//Get the table name from the query
preg_match("/SELECT(.*)FROM( )([A-z_]+)/i",$query,$matches);
$table_name = $matches[3];

$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
$rows = mysql_num_rows($result);
session_start();
$_SESSION['displayrows'] = $rows;
$columns = mysql_fetch_assoc($result);

if ($rows > 0) { // Only proceed if we have a result

mysql_data_seek($result,0);
while ($row=mysql_fetch_array($result)) {

foreach ($columns As $key=>$value) {


//Run any extra functions that have been sent over
if(is_array($func)) {
foreach ($func AS $Fkey=>$Fvalue) {
$row[$key] = $this->$Fvalue($row[$key],$key,$table_name);
} // end FE
} // end IF

if($type == "object") {
//echo $key . " " . $row[$key] . "\n";
$tmp->$key = $row[$key];
} else {
$tmp[$key] = $row[$key];
}

}// end for each

$results[] = $tmp;
unset($tmp);
} //end while

$final_result['result'] = $results;
$final_result['rows'] = mysql_num_rows($result);
} else {
$final_result['rows'] = 0;
}// end if

return $final_result;

} // end function


}

if ((isset($_GET['keywords']) && !empty($_GET['keywords'])) && (isset($_GET['sport']) && !empty($_GET['sport']))

){

$query = "SELECT *,
(((acos(sin((".$latitude."*pi()/180)) * sin((`lat`*pi()/180))
+cos((".$latitude."*pi()/180)) * cos((`lat`*pi()/180))
* cos(((".$longitude."- `lng`)*pi()/180))))*180/pi())*60*1.1515)
as distance
FROM `pitch` WHERE ( (title LIKE '%".$_GET['keywords']."%') or (description LIKE '%".$_GET['keywords']."%') or (address LIKE '%".$_GET['keywords']."%')) AND (sport LIKE '%".$_GET['sport']."%') AND (pitch_type1 = '$grass')
ORDER BY distance ASC
LIMIT 0,4
"; }else{

$query = "SELECT *,
(((acos(sin((".$latitude."*pi()/180)) * sin((`lat`*pi()/180))
+cos((".$latitude."*pi()/180)) * cos((`lat`*pi()/180))
* cos(((".$longitude."- `lng`)*pi()/180))))*180/pi())*60*1.1515)
as distance
FROM `pitch`
ORDER BY distance ASC
LIMIT 0,4
";
}


$pitchs = $this->db->executeQuery($query);
$pitchs = $pitchs['result'];
return $pitchs;

}