PDA

View Full Version : Repeating Region Control



RL Joneson
08-19-2008, 06:20 AM
I'm looking to have some serious control over a Repeating Region. I've set up this code with DWCS3 on a 185px table nested in a 575px table. What I want to do is repeat the nested table 3 times horizontal, then move down to the next row and repeat another 3 times horizontal, and so on. As of now, it just puts each repeat vertically down the page, in a list-like way.

Here's the code thus far. The record name is "Crutches". Any help would be greatly appreciated!


$maxRows_Crutches = 9;
$pageNum_Crutches = 0;
if (isset($_GET['pageNum_Crutches'])) {
$pageNum_Crutches = $_GET['pageNum_Crutches'];
}
$startRow_Crutches = $pageNum_Crutches * $maxRows_Crutches;

mysql_select_db($database_PRHconn, $PRHconn);
$query_Crutches = "SELECT * FROM crutches ORDER BY crutchName ASC";
$query_limit_Crutches = sprintf("%s LIMIT %d, %d", $query_Crutches, $startRow_Crutches, $maxRows_Crutches);
$Crutches = mysql_query($query_limit_Crutches, $PRHconn) or die(mysql_error());
$row_Crutches = mysql_fetch_assoc($Crutches);

if (isset($_GET['totalRows_Crutches'])) {
$totalRows_Crutches = $_GET['totalRows_Crutches'];
} else {
$all_Crutches = mysql_query($query_Crutches);
$totalRows_Crutches = mysql_num_rows($all_Crutches);
}
$totalPages_Crutches = ceil($totalRows_Crutches/$maxRows_Crutches)-1;

RL Joneson
08-20-2008, 07:51 AM
Got it to work with a nice looper extension. case closed

JShor
08-21-2008, 02:15 AM
use while(); to loop, and use a variable to declare the amount of rows you posted--once you have 3 rows horizontally, it'll skip to the next row; just a sec, i'm working on code for u.

JShor
08-21-2008, 02:23 AM
$maxRows_Crutches = 9;
$pageNum_Crutches = 0;
if (isset($_GET['pageNum_Crutches'])) {
$pageNum_Crutches = $_GET['pageNum_Crutches'];
}
$startRow_Crutches = $pageNum_Crutches * $maxRows_Crutches;

mysql_select_db($database_PRHconn, $PRHconn);
$query_Crutches = "SELECT * FROM crutches ORDER BY crutchName ASC";
$query_limit_Crutches = sprintf("%s LIMIT %d, %d", $query_Crutches, $startRow_Crutches, $maxRows_Crutches);
$Crutches = mysql_query($query_limit_Crutches, $PRHconn) or die(mysql_error());
$row_Crutches = mysql_fetch_assoc($Crutches);

if (isset($_GET['totalRows_Crutches'])) {
$totalRows_Crutches = $_GET['totalRows_Crutches'];
} else {
$all_Crutches = mysql_query($query_Crutches);
$totalRows_Crutches = mysql_num_rows($all_Crutches);
}
$totalPages_Crutches = ceil($totalRows_Crutches/$maxRows_Crutches)-1;

while($c = mysql_fetch_array( $Crutches )) {

$rowsNUM = $rowsNUM + 1; // this is where we keep adding rows

if($rowsNUM == 3) { // if there are already 3 horizontal thingys

$rowsNUM = 0; // reset it to ZERO

echo '
</tr>
<tr>
'; // start new row

}

echo '
<td>'.$c[data1].'</td>'; // please remember to edit this to display what you want! the identifier var is $c

} // stop whiling

echo '</table>';




record name is $Crutches, and your row data variable is $c. good luck ;-)