<?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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
mysql_select_db($database_db, $db);
$query_news2 = "SELECT * FROM newsticker";
$news2 = mysql_query($query_news2, $db) or die(mysql_error());
$row_news2 = mysql_fetch_assoc($news2);
$totalRows_news2 = mysql_num_rows($news2);
mysql_select_db($database_db, $db);
$query_offer = "SELECT * FROM aanbiedingen";
$offer = mysql_query($query_offer, $db) or die(mysql_error());
$row_offer = mysql_fetch_assoc($offer);
$totalRows_offer = mysql_num_rows($offer);
$maxRows_accos = 5;
$pageNum_accos = 0;
if (isset($_GET['pageNum_accos'])) {
$pageNum_accos = $_GET['pageNum_accos'];
}
$startRow_accos = $pageNum_accos * $maxRows_accos;
mysql_select_db($database_db, $db);
$query_accos = "SELECT * FROM accos ORDER BY price_from ASC";
$query_limit_accos = sprintf("%s LIMIT %d, %d", $query_accos, $startRow_accos, $maxRows_accos);
$accos = mysql_query($query_limit_accos, $db) or die(mysql_error());
$row_accos = mysql_fetch_assoc($accos);
if (isset($_GET['totalRows_accos'])) {
$totalRows_accos = $_GET['totalRows_accos'];
} else {
$all_accos = mysql_query($query_accos);
$totalRows_accos = mysql_num_rows($all_accos);
}
$totalPages_accos = ceil($totalRows_accos/$maxRows_accos)-1;
$queryString_accos = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_accos") == false &&
stristr($param, "totalRows_accos") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_accos = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_accos = sprintf("&totalRows_accos=%d%s", $totalRows_accos, $queryString_accos);
?>