Allora spero che mi aiuterete voi che siete degli esperti... ho scaricato uno script che lavora con js in php, per ricercare utenti nel database, e fin qui funziona perfettamente, il punto e che non riesco a far lavorare insieme ai campi del modulo la ricerca, se un utente mette nella textarea il nome utente lo ricerca se clicco ascendente o desc mi ricerca gli utenti nella lista in base al nome, ma ecco l inghippo, se inserisco un campo femmina o maschio non riesco a far visualizzare il nome di ricerca ad esempio mario insieme al campo maschio, mi visualizza sia maschio e femmina, lo script ha veramente pochissimi fili li posto:
getData.php
getData.php
PHP:
<?php
if(isset($_GET['page'])){
//Include pagination class file
include('Pagination.php');
//Include database configuration file
include('dbConfig.php');
$start = !empty($_GET['page'])?$_GET['page']:0;
$limit = 25;
//set conditions for search
$whereSQL = $orderSQL = '';
$keywords = $_GET['keywords'];
$keyname = $_GET['keyname'];
$sortBy = $_GET['sortBy'];
if(!empty($keyname)){
$whereSQL = "WHERE name LIKE '%".$keyname."%'";
}
elseif(!empty($keywords)){
$whereSQ = "WHERE member_group_id LIKE '".$keywords."'";
}
if(!empty($sortBy)){
$orderSQL = " ORDER BY name ".$sortBy;
}else{
$orderSQL = " ORDER BY name DESC ";
}
//get number of rows
$queryNum = $db->query("SELECT COUNT(*) as name FROM ILFREE_core_members ".$whereSQL.$whereSQ.$orderSQL);
$resultNum = $queryNum->fetch_assoc();
$rowCount = $resultNum['name'];
//initialize pagination class
$pagConfig = array(
'currentPage' => $start,
'totalRows' => $rowCount,
'perPage' => $limit,
'link_func' => 'searchFilter'
);
$pagination = new Pagination($pagConfig);
//get rows
$query = $db->query("SELECT * FROM ILFREE_core_members $whereSQL $whereSQ $orderSQL LIMIT $start,$limit");
if($query->num_rows > 0){ ?>
<div class="GETs_list">
<?php
while($row = $query->fetch_assoc()){
$GroupID = $row["member_group_id"];
$IDgroup = array('29','77','62','83','46','43','73','58','68','2','78','63','82','45','42','71','52','67','27','76','60','81','44','41','70','56','65');
$GETID = $row['member_id'];
$Name = $row["name"];
$photo = $row["pp_main_photo"];
$bannato = '7';
?>
<div class="list_item">
<?php
// name
echo '<a href="http://www.xxxx.it/index.php?/profile/' . $GETID . '-' . $Name . '" title="Visualizza il profilo di ' . $Name . '" ><h2>' . $Name . '</h2></a>';
// foto
if(empty($photo)) { if(in_array($GroupID, $IDgroup)) {
echo '<a href="http://www.xxxx.it/index.php?/profile/' . $GETID . '-' . $Name . '" title="Visualizza il profilo di ' . $Name . '"><img src="http://www.xxxx.it/uploads/file/search_femmina.png"/></a>'; }
elseif ($bannato == $GroupID) {
echo '<a href="http://www.xxxx.it/index.php?/profile/' . $GETID . '-' . $Name . '" title="Visualizza il profilo di ' . $Name . '"><img src="http://www.xxxx.it/uploads/file/ban.png"/></a>'; }
else {
echo '<a href="http://www.xxxx.it/index.php?/profile/' . $GETID . '-' . $Name . '" title="Visualizza il profilo di ' . $Name . '"><img src="http://www.xxxx.it/uploads/file/search_maschio.png"/></a>'; } }
else{
echo '<a href="http://www.xxxx.it/index.php?/profile/' . $GETID . '-' . $Name . '" title="Visualizza il profilo di ' . $Name . '"><img src="http://www.xxxx.it/uploads/profile_photos/' . $photo . '"/></a>';
}
?>
</div>
<?php } ?>
</div>
<?php echo $pagination->createLinks(); ?>
<?php } } ?>