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
|
<?php
mysql_select_db($database_DirectoryIsmeca, $DirectoryIsmeca);
$query_rs_society = "SELECT * FROM Societies";
$rs_society = mysql_query($query_rs_society, $DirectoryIsmeca) or die(mysql_error());
$row_rs_society = mysql_fetch_assoc($rs_society);
$totalRows_rs_society = mysql_num_rows($rs_society);
mysql_select_db($database_DirectoryIsmeca, $DirectoryIsmeca);
$query_rs_GrpFonc = "SELECT FuncGrpName FROM FuncGrp ORDER BY FuncGrpName ASC";
$rs_GrpFonc = mysql_query($query_rs_GrpFonc, $DirectoryIsmeca) or die(mysql_error());
$row_rs_GrpFonc = mysql_fetch_assoc($rs_GrpFonc);
$totalRows_rs_GrpFonc = mysql_num_rows($rs_GrpFonc);
$Filter3_rs_liste1 = "%";
if (isset($_GET['search_group'])) {
$Filter3_rs_liste1 = (get_magic_quotes_gpc()) ? $_GET['search_group'] : addslashes($_GET['search_group']);
}
$Filter4_rs_liste1 = "%";
if (isset($_GET['search_phone'])) {
$Filter4_rs_liste1 = (get_magic_quotes_gpc()) ? $_GET['search_phone'] : addslashes($_GET['search_phone']);
}
$Filter2_rs_liste1 = "%";
if (isset($_GET['search_society'])) {
$Filter2_rs_liste1 = (get_magic_quotes_gpc()) ? $_GET['search_society'] : addslashes($_GET['search_society']);
}
$Filter1_rs_liste1 = "%";
if (isset($_GET['search_name'])) {
$Filter1_rs_liste1 = (get_magic_quotes_gpc()) ? $_GET['search_name'] : addslashes($_GET['search_name']);
}
mysql_select_db($database_DirectoryIsmeca, $DirectoryIsmeca);
$query_rs_liste1 = sprintf("SELECT Persons.IdPerson, Persons.Lastname, Persons.Firstname, Persons.Society, Persons.Phone1, Persons.Phone2, Persons.Phone3, Persons.FuncGrp1, Persons.FuncGrp2, Persons.FuncGrp3, FuncGrp.FuncGrpName, FuncGrp_2.FuncGrpName AS FuncGrpName2 , FuncGrp_3.FuncGrpName AS FuncGrpName3 FROM ((Persons LEFT JOIN FuncGrp ON Persons.FuncGrp1 = FuncGrp.IdFuncGrp) LEFT JOIN FuncGrp AS FuncGrp_2 ON Persons.FuncGrp2 = FuncGrp_2.IdFuncGrp) LEFT JOIN FuncGrp AS FuncGrp_3 ON Persons.FuncGrp3 = FuncGrp_3.IdFuncGrp WHERE (Persons.Lastname Like '%s%%' OR Persons.Firstname Like '%s%%' ) AND Persons.Society like '%s' AND (FuncGrp.FuncGrpName like '%s' OR FuncGrp_2.FuncGrpName like '%s' OR FuncGrp_3.FuncGrpName like '%s') AND (Persons.Phone1 like '%%%s%%' OR Persons.Phone2 like '%%%s%%' OR Persons.Phone3 like '%%%s%%') ORDER BY Lastname ASC", $Filter1_rs_liste1,$Filter1_rs_liste1,$Filter2_rs_liste1,$Filter3_rs_liste1,$Filter3_rs_liste1,$Filter3_rs_liste1,$Filter4_rs_liste1,$Filter4_rs_liste1,$Filter4_rs_liste1);
$rs_liste1 = mysql_query($query_rs_liste1, $DirectoryIsmeca) or die(mysql_error());
$row_rs_liste1 = mysql_fetch_assoc($rs_liste1);
$totalRows_rs_liste1 = mysql_num_rows($rs_liste1);
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;
}
}
?> |