Is it possible to do a nested repeat? Here is my code. Every thing works until I try to do the second repeat. What do I need to change or is it possible?
?php require_once('../../Connections/LEPCEMA.php'); ?> <?php if (!function_exists("GetSQLiValueString")) { function GetSQLiValueString($theConnection, $theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; }
$theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($theConnection, $theValue) : mysqli_escape_string($theConnection, $theValue);
switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?> <?php //************************** // ProfRecWiz - MySqli // http://www.dwzone-it.com // Version: 1.0.17 //************************** mysqli_select_db($LEPCEMA, $database_LEPCEMA); $mysqli_RiskFacilities_query = "SELECT LocalBusinesses.RiskFacilityID, LocalBusinesses.RiskFacilityName, LocalBusinesses.Latitude, LocalBusinesses.longitude, LocalBusinesses.EstimatedPeople FROM LocalBusinesses ORDER BY LocalBusinesses.RiskFacilityName Asc"; $RiskFacilities = mysqli_query($LEPCEMA, $mysqli_RiskFacilities_query) or die(mysqli_error($LEPCEMA)); $row_RiskFacilities = mysqli_fetch_assoc($RiskFacilities); $totalRows_RiskFacilities = mysqli_num_rows($RiskFacilities); //************************** // ProfRecWiz - MySqli //************************** ?>
<?php //************************** // ProfRecWiz - MySqli // http://www.dwzone-it.com // Version: 1.0.17 //************************** mysqli_select_db($LEPCEMA, $database_LEPCEMA); $mysqli_facilities_query = "SELECT TierIIFacilities.*, TierIIFacilities.FacilityID, TierIIFacilities.FcilltiyName FROM TierIIFacilities ORDER BY TierIIFacilities.FcilltiyName Asc"; $facilities = mysqli_query($LEPCEMA, $mysqli_facilities_query) or die(mysqli_error($LEPCEMA)); $row_facilities = mysqli_fetch_assoc($facilities); $totalRows_facilities = mysqli_num_rows($facilities); //************************** // ProfRecWiz - MySqli //************************** ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <style type="text/css"> <!-- --> </style> </head>
<body> <table border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" valign="top"></td> </tr> <tr> <td width="322" height="45"><b>Tier II Facility</b></td> <td width="326" height="45"><b>Facilities At Risk</b></td> </tr> <tr> <?php //***************************** // ProfRecWiz // Repeat Region // Before Selection Instance //***************************** $dwz_loop = 0; $dwzLoopName = "Repeat1"; $dwzMaxRec = "-1"; do{ $dwz_loop += 1; //End Repeat region ?> <td width="322" height="45"><?php echo dwzGetRecValue('facilities','FcilltiyName'); ?></td> <td width="326" height="45"> <?php //***************************** // ProfRecWiz // Repeat Region // Before Selection Instance //***************************** $dwz_loop = 0; $dwzLoopName = "Repeat3"; $dwzMaxRec = "-1"; do{ $dwz_loop += 1; //End Repeat region ?> <?php //************************** // http://www.DwZone-it.com // CONDITIONAL REGION // Version: 1.0.8 //************************** $lat1= dwzGetRecValue('facilities','Latitude'); $lng1= dwzGetRecValue('facilities','Longitude') ; $lat2 = dwzGetRecValue('RiskFacilities','Latitude'); $lng2 = dwzGetRecValue('RiskFacilities','longitude'); $driven_distance = getDistance($lat1,$lng1,$lat2,$lng2,$unit); if(($driven_distance) < (2)) { echo dwzGetRecValue('RiskFacilities','RiskFacilityName'), " ", $driven_distance, " miles" ?><br> <?php //************************** // CONDITIONAL REGION //************************** } ?> <?php //***************************** // ProfRecWiz // Repeat Region // After Selection Instance //***************************** $dwzLoopName = "Repeat3"; if($dwzMaxRec != "" && $dwzMaxRec != "-1"){ if(intval($dwz_loop) >= intval($dwzMaxRec)){ break; } } }while($row_RiskFacilities = mysqli_fetch_assoc($RiskFacilities)); //End Repeat region ?> </td> <?php //***************************** // ProfRecWiz // Repeat Region // After Selection Instance //***************************** $dwzLoopName = "Repeat1"; if($dwzMaxRec != "" && $dwzMaxRec != "-1"){ if(intval($dwz_loop) >= intval($dwzMaxRec)){ break; } } }while($row_facilities = mysqli_fetch_assoc($facilities)); //End Repeat region ?> </tr> <tr> <td width="322" height="45"> </td> <td width="326" height="45"> </td> </tr> <tr> <td width="322" height="45"> <p><b><span style="font-size: 13.0pt">-</span></b> </p> </td> <td width="326" height="45" bgcolor="#ffffff"> </td> </tr> <tr> <td height="45"></td> <td height="45"></td> </tr> <tr> <td width="322" height="45"> </td> <td width="326" height="45"> </td> </tr> <tr> <td height="45"> </td> <td height="45"> </td> </tr> <tr> <td height="45"></td> <td height="45"></td> </tr> <tr> <td width="322" height="45"> </td> <td width="326" height="45"> </td> </tr> </table> </body> </html> <?php //************************** // ProfRecWiz - MySqli //************************** mysqli_free_result($RiskFacilities); //************************** // ProfRecWiz - MySqli //************************** ?> <?php //************************** // ProfRecWiz - MySqli //************************** mysqli_free_result($facilities); //************************** // ProfRecWiz - MySqli //************************** ?> <?php //************************** // ProfRecWiz //************************** function dwzGetRecValue($rec, $field){ if(isset($GLOBALS['row_'.$rec])){ return $GLOBALS['row_'.$rec][$field]; }else{ return $rec .'.' .$field; } } //************************** // ProfRecWiz //************************** ?> <?php function getDistance($latitude1, $longitude1, $latitude2, $longitude2, $unit = 'Mi') { $theta = $longitude1 - $longitude2; $distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); $distance = acos($distance); $distance = rad2deg($distance); $distance = $distance * 60 * 1.1515; switch($unit) { case 'm': break; case 'K' : $distance = $distance *1.609344; } return (round($distance,2)); }
?> |
|
|