Ciao Ginko, hai ragione.
Codice PHP:
<?php require_once('../../Connections/products.php'); ?>
<?php
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;
}
}
$tipologia = $_REQUEST['tipologia'];
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_rs_risultato = 20;
$pageNum_rs_risultato = 0;
if (isset($_REQUEST['pageNum_rs_risultato'])) {
$pageNum_rs_risultato = $_REQUEST['pageNum_rs_risultato'];
}
$startRow_rs_risultato = $pageNum_rs_risultato * $maxRows_rs_risultato;
$colname_rs_risultato = "%";
if (isset($_REQUEST['tipologia'])) {
$colname_rs_risultato = (get_magic_quotes_gpc()) ? $_REQUEST['tipologia'] : addslashes($_REQUEST['tipologia']);
}
mysql_select_db($database_products, $products);
$query_rs_risultato = sprintf("SELECT codice, descrizione FROM a_prodotti_generale WHERE tipologia LIKE %s", GetSQLValueString($colname_rs_risultato, "text"));
$query_limit_rs_risultato = sprintf("%s LIMIT %d, %d", $query_rs_risultato, $startRow_rs_risultato, $maxRows_rs_risultato);
$rs_risultato = mysql_query($query_limit_rs_risultato, $products) or die(mysql_error());
$row_rs_risultato = mysql_fetch_assoc($rs_risultato);
if (isset($_GET['totalRows_rs_risultato'])) {
$totalRows_rs_risultato = $_GET['totalRows_rs_risultato'];
} else {
$all_rs_risultato = mysql_query($query_rs_risultato);
$totalRows_rs_risultato = mysql_num_rows($all_rs_risultato);
}
$totalPages_rs_risultato = ceil($totalRows_rs_risultato/$maxRows_rs_risultato)-1;
$queryString_rs_risultato = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rs_risultato") == false &&
stristr($param, "totalRows_rs_risultato") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rs_risultato = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rs_risultato = sprintf("&totalRows_rs_risultato=%d%s", $totalRows_rs_risultato, $queryString_rs_risultato);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>
<table width="100%" border="1">
<tr>
<td>Codice</td>
<td>Descrizione</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_rs_risultato['codice']; ?></td>
<td><?php echo $row_rs_risultato['descrizione']; ?></td>
</tr>
<?php } while ($row_rs_risultato = mysql_fetch_assoc($rs_risultato)); ?>
</table>
[url="<?php printf("]">Avanti[/url]</p>
</body>
</html>
<?php
mysql_free_result($rs_risultato);
?>