1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| $maxRows_Recordset1 = 15;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$whereAnd = array();
if (!empty($_GET['annee_debut']) && !empty($_GET['annee_fin']))
{
$whereAnd[] = " (annee BETWEEN ". intval($_GET['annee_debut']) . " AND " . intval($_GET['annee_fin']) . ") ";
}
if (!empty($_GET['annee']))
{
$whereAnd[] = " annee LIKE '%" . mysql_real_escape_string(urldecode($_GET['annee'])) . "%' ";
}
if (!empty($_GET['lui_nom']))
{
$whereAnd[] = " lui_nom LIKE '%" . mysql_real_escape_string(urldecode($_GET['lui_nom'])) . "%' ";
}
if (!empty($_GET['lui_prenom']))
{
$whereAnd[] = " lui_prenom LIKE '%" . mysql_real_escape_string(urldecode($_GET['lui_prenom'])) . "%' ";
}
if (!empty($_GET['lui_profession']))
{
$whereAnd[] = " lui_profession LIKE '%" . mysql_real_escape_string(urldecode($_GET['lui_profession'])) . "%' ";
}
if (!empty($_GET['elle_profession']))
{
$whereAnd[] = " elle_profession LIKE '%" . mysql_real_escape_string(urldecode($_GET['elle_profession'])) . "%' ";
}
if (!empty($_GET['elle_nom']))
{
$whereAnd[] = " elle_nom LIKE '%" . mysql_real_escape_string(urldecode($_GET['elle_nom'])) . "%' ";
}
if (!empty($_GET['elle_prenom']))
{
$whereAnd[] = " elle_prenom LIKE '%" . mysql_real_escape_string(urldecode($_GET['elle_prenom'])) . "%' ";
}
mysql_select_db($database_connnp, $connnp);
$query_Recordset1 = "SELECT * FROM ec ";
if( !empty($whereAnd) ){
$query_Recordset1 .= " WHERE " . implode( " AND ", $whereAnd );
}
$query_Recordset1 .= " ORDER BY annee, lui_nom ASC";
// $query_Recordset1=urldecode($query_Recordset1);
// echo '<font color="red">'.($query_Recordset1).'</font>';
// die();
$_SESSION['monSql'] = $query_Recordset1 ;
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $connnp) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-
1;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); |
Partager