What shall I do so when I choose the word "all" from a "select" of a html form, the results that appear are all the values of a column of a data base Mysql. Now the search only works when finds a equivalent with the data base from the "select" html.
Please, find below the program:
Could you have a look at it.
<?php require_once('Connections/conexs.php'); ?>
<?php
$maxRows_consulta = 10;
$pageNum_consulta = 0;
if (isset($HTTP_GET_VARS['pageNum_consulta'])) {
$pageNum_consulta = $HTTP_GET_VARS['pageNum_consulta'];
}
$startRow_consulta = $pageNum_consulta * $maxRows_consulta;
$colname_consulta = "1";
if (isset($HTTP_GET_VARS['poblacio'])) {
$colname_consulta = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['poblacio'] : addslashes($HTTP_GET_VARS['poblacio']);
}
$varpob_consulta = "1";
if (isset($HTTP_GET_VARS['tipus'])) {
$varpob_consulta = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['tipus'] : addslashes($HTTP_GET_VARS['tipus']);
}
mysql_select_db($database_conexs, $conexs);
$query_consulta = sprintf("SELECT tipus, poblacio, zona, foto1, foto2, descrip, preu FROM bens WHERE poblacio= '%s' and tipus = '%s'", $colname_consulta,$varpob_consulta);
$query_limit_consulta = sprintf("%s LIMIT %d, %d", $query_consulta, $startRow_consulta, $maxRows_consulta);
$consulta = mysql_query($query_limit_consulta, $conexs) or die(mysql_error());
$row_consulta = mysql_fetch_assoc($consulta);
if (isset($HTTP_GET_VARS['totalRows_consulta'])) {
$totalRows_consulta = $HTTP_GET_VARS['totalRows_consulta'];
} else {
$all_consulta = mysql_query($query_consulta);
$totalRows_consulta = mysql_num_rows($all_consulta);
}
$totalPages_consulta = ceil($totalRows_consulta/$maxRows_consulta)-1;
?>