vacances2000
Gebruiker
- Lid geworden
- 28 jan 2013
- Berichten
- 121
Beste,
Een beetje jammer dat ze met dreamweaver, zelfs bij cs6, geen functie/ optie "aantal kolommen" hebben bij het creeeren van een recordset. Mijn probleem is ik heb nu 700 rijen die ik graag over 3 kolommen zou weergegeven zien ipv van over 1 kolom. Iemand hiervoor een oplossing?
Tweede kleine punt is onderaan heb ik vorig, laatst, next etc... weet iemand hoe je ook automatisch daar blz 1-2-3-4-5 in krijgt? dus eerste - vorig - 1-2-3-4-5 - Volgend- laatst?
Alvast dank
Jonathan
Een beetje jammer dat ze met dreamweaver, zelfs bij cs6, geen functie/ optie "aantal kolommen" hebben bij het creeeren van een recordset. Mijn probleem is ik heb nu 700 rijen die ik graag over 3 kolommen zou weergegeven zien ipv van over 1 kolom. Iemand hiervoor een oplossing?
Tweede kleine punt is onderaan heb ik vorig, laatst, next etc... weet iemand hoe je ook automatisch daar blz 1-2-3-4-5 in krijgt? dus eerste - vorig - 1-2-3-4-5 - Volgend- laatst?
Alvast dank
Jonathan
PHP:
<?php require_once('Connections/budgetro1.php'); ?>
<?php require_once('Connections/budgetro1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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_products = 10;
$pageNum_products = 10;
if (isset($_GET['pageNum_products'])) {
$pageNum_products = $_GET['pageNum_products'];
}
$startRow_products = $pageNum_products * $maxRows_products;
mysql_select_db($database_budgetro1, $budgetro1);
$query_products = "SELECT * FROM `products-dreaweaver`";
$query_limit_products = sprintf("%s LIMIT %d, %d", $query_products, $startRow_products, $maxRows_products);
$products = mysql_query($query_limit_products, $budgetro1) or die(mysql_error());
$row_products = mysql_fetch_assoc($products);
if (isset($_GET['totalRows_products'])) {
$totalRows_products = $_GET['totalRows_products'];
} else {
$all_products = mysql_query($query_products);
$totalRows_products = mysql_num_rows($all_products);
}
$totalPages_products = ceil($totalRows_products/$maxRows_products)-1;
mysql_select_db($database_budgetro1, $budgetro1);
$query_short = "SELECT products_name, products_url, manufacturer, Price, SKU, `Image link` FROM `products-dreaweaver`";
$short = mysql_query($query_short, $budgetro1) or die(mysql_error());
$row_short = mysql_fetch_assoc($short);
$totalRows_short = mysql_num_rows($short);
$queryString_products = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_products") == false &&
stristr($param, "totalRows_products") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_products = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_products = sprintf("&totalRows_products=%d%s", $totalRows_products, $queryString_products);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>database test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="sub1_css.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="Layer5" class="Layer5">
<?php do { ?>
<table width="677" class="tabel1" bordercolor="#339900" style="margin:20px" cellpadding="5px">
<tr>
<td colspan="3" valign="top"><font size="+1" color="#339900" ><strong><?php echo $row_products['products_name']; ?></strong></font></td>
<td width="124" rowspan="5" valign="top"><p><img src="<?php echo $row_products['Image link']; ?>"></p>
<p><a href="<?php echo $row_products['products_url']; ?>"><font size="+1">Book this tour</font></a></p></td>
</tr>
<tr>
<th width="78" align="right" valign="top">Description:</th>
<td colspan="2" valign="top"><p><?php echo $row_products['products_tags']; ?></p></td>
</tr>
<tr>
<th align="right" valign="top">Price:</th>
<td width="300" valign="top"><?php echo $row_products['Price']; ?> $</td>
<td width="157" valign="top">Tour code: <?php echo $row_products['SKU']; ?></td>
</tr>
<tr>
<th align="right" valign="top">Offered by</th>
<td valign="top"><?php echo $row_products['manufacturer']; ?></td>
<td align="right" valign="top"> </td>
</tr>
<tr>
<th align="right" valign="top">Tags:</th>
<td colspan="2" valign="top"><?php echo $row_products['products_short_description']; ?></td>
</tr>
</table>
<?php } while ($row_products = mysql_fetch_assoc($products)); ?>
<p>Records <?php echo ($startRow_products + 1) ?> to <?php echo min($startRow_products + $maxRows_products, $totalRows_products) ?> of <?php echo $totalRows_products ?>
<table border="0">
<tr>
<td width="34"><?php if ($pageNum_products > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_products=%d%s", $currentPage, 0, $queryString_products); ?>">First</a>
<?php } // Show if not first page ?></td>
<td width="63"><?php if ($pageNum_products > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_products=%d%s", $currentPage, max(0, $pageNum_products - 1), $queryString_products); ?>">Previous</a>
<?php } // Show if not first page ?></td>
<td width="126"> </td>
<td width="33"><?php if ($pageNum_products < $totalPages_products) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_products=%d%s", $currentPage, min($totalPages_products, $pageNum_products + 1), $queryString_products); ?>">Next</a>
<?php } // Show if not last page ?></td>
<td width="31"><?php if ($pageNum_products < $totalPages_products) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_products=%d%s", $currentPage, $totalPages_products, $queryString_products); ?>">Last</a>
<?php } // Show if not last page ?></td>
</tr>
</table>
</p>
<p> </p>
</div>
<div id="layer4" class="Layer4">
<table width="332" border="0"><font size="-1">
<tr>
<td width="235" height="100"><p><font size="+1" color="#00CC00"><?php echo $row_short['products_name']; ?></font>
</p>
<p>Price: <?php echo $row_short['Price']; ?> $ </p>
<p>Tour code:<?php echo $row_short['SKU']; ?></p>
<p> Offered by: <?php echo $row_short['manufacturer']; ?></p></td>
<td width="87" valign="top"><p><img src="<?php echo $row_short['Image link']; ?>"></p>
<p><a href="<?php echo $row_short['products_url']; ?>">Book now</a></p></td>
</tr></font>
</table>
</br>
</div>
</body>
<?php
mysql_free_result($products);
mysql_free_result($short);
?>