Your Ad Here

Thursday, April 2, 2009

Display Reapeat Region in 2 columns, how to do it?

Hi there!
I am a newbie into PHP language and I am using Dreamweaver to learn some basics and so I am doing myself a database administration with records display or list as test.
So, on dream weaver I managed to make a list using repeat region but only with one column of data... here is the code:


Code:
---------

if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "10";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "../error_success/access_denied.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_modelos = 20;
$pageNum_modelos = 0;
if (isset($_GET['pageNum_modelos'])) {
$pageNum_modelos = $_GET['pageNum_modelos'];
}
$startRow_modelos = $pageNum_modelos * $maxRows_modelos;

mysql_select_db($database_pachecos, $pachecos);
$query_modelos = "SELECT * FROM modelos ORDER BY Modelo ASC";
$query_limit_modelos = sprintf("%s LIMIT %d, %d", $query_modelos, $startRow_modelos, $maxRows_modelos);
$modelos = mysql_query($query_limit_modelos, $pachecos) or die(mysql_error());
$row_modelos = mysql_fetch_assoc($modelos);

if (isset($_GET['totalRows_modelos'])) {
$totalRows_modelos = $_GET['totalRows_modelos'];
} else {
$all_modelos = mysql_query($query_modelos);
$totalRows_modelos = mysql_num_rows($all_modelos);
}
$totalPages_modelos = ceil($totalRows_modelos/$maxRows_modelos)-1;

$queryString_modelos = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_modelos") == false &&
stristr($param, "totalRows_modelos") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_modelos = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_modelos = sprintf("&totalRows_modelos=%d%s", $totalRows_modelos, $queryString_modelos);
?>





PM - Lista de Modelos




























 



Logotipo

























    F�brica
Pachecos  
     
Departamento
 
 








Lista de modelos














    Editar Apagar  
 















  NOVO 0) { // Show if not first page ?>
">
0) { // Show if not first page ?>
">

">

">
 Registo do n� at� de


*
 
   




mysql_free_result($modelos);
?>
---------
Is it possible to make this work displaying two columns of records instead of just one?

thank you in advance for your time and patience. :^o

Read More...
Your Ad Here

No comments: