2017-04-06 77 views
0
$_SESSION['post'] = array($_SESSION['gender'],$_SESSION['star'],$_SESSION['caste'],$_SESSION['marital'],$_SESSION['salary'],$_SESSION['education'],$_SESSION['from'],$_SESSION['to'],$_SESSION['district'],$_SESSION['country_liv']); 
    $post=$_SESSION['post']; 
echo $post[9]; //printing the country value 
$page = (int)(!isset($_GET["page"]) ? 1 : $_GET["page"]); 
if ($page <= 0) $page = 1; 


$per_page = 5; // Set how many records do you want to display per page. 
$startpoint = ($page * $per_page) - $per_page; 

$statement = "`tbl_member` where member_id!=$member_id AND TIMESTAMPDIFF(YEAR, dob, CURDATE())>='$post[6]' AND 
    TIMESTAMPDIFF(YEAR, dob, CURDATE())<='$post[7]' AND gender Like '$post[0]%' AND star LIKE '%$post[1]%' AND caste LIKE '%$post[2]%' AND mari_status LIKE '%$post[3]%' AND education LIKE '%$post[5]%' AND city_town LIKE '$post[8]%' AND month_income LIKE '%$post[4]%' AND country_liv LIKE '%$post[9]%'"; 


    $results=mysqli_set_charset($conDB, "utf8"); 
$results = mysqli_query($conDB,"SELECT * FROM {$statement} LIMIT {$startpoint} , {$per_page}"); 

現在我編... 它我對所有的編碼請幫我....多發和條件在選擇查詢PHP MYSQL myadmin一個條件不工作

我想顯示具體的國家在結果....

我可以得到用戶輸入,但是當我使用這個查詢它不工作.. 現在我編輯... 其我所有的編碼,請幫助我....

我想在此顯示特定的國家Ë結果....

我能得到用戶的輸入,但是當我使用此查詢其沒有工作..

+0

你的'''country_liv'''是什麼?它是數據庫中的'''varchar'''還是'''int''? – kishor10d

+0

plz chk如果ur staement正確生成,我的意思是你打印你的選擇查詢,並檢查是否打印所有的值。 –

+0

country_liv is varchar –

回答

0
I'M changed the statement this :  

$statement = "`tbl_member` where member_id!=$member_id AND TIMESTAMPDIFF(YEAR, dob, CURDATE())>='$post[6]' AND 
     TIMESTAMPDIFF(YEAR, dob, CURDATE())<='$post[7]' AND gender Like '$post[0]%' AND star LIKE '%$post[1]%' AND caste LIKE '%$post[2]%' AND mari_status LIKE '%$post[3]%' AND education LIKE '%$post[5]%' AND city_town LIKE '$post[8]%' AND month_income LIKE '%$post[4]%' AND country_liv LIKE '%$post[9]%'"; 

這樣:

$statement = "`tbl_member` where month_income LIKE '%$post[4]%' AND TIMESTAMPDIFF(YEAR, dob, CURDATE())>='$post[6]' AND 
    TIMESTAMPDIFF(YEAR, dob, CURDATE())<='$post[7]' AND member_id!=$member_id AND country_liv LIKE '%$post[9]%' AND gender Like '$post[0]%' AND star LIKE '%$post[1]%' AND caste LIKE '%$post[2]%' AND mari_status LIKE '%$post[3]%' AND education LIKE '%$post[5]%' AND city_town LIKE '$post[8]%' "; 

謝謝啦...它爲我工作