supanoob Posted April 26, 2007 Share Posted April 26, 2007 <?php $young=$_POST['age_young']; $old=$_POST['age_old']; $from=$_POST['from']; $sex=$_POST['sex']; $played_more=$_POST['played_more']; $played_less=$_POST['played_less']; $points_more=$_POST['points_more']; $points_less=$_POST['points_less']; if ($young == '') { $young = '0'; } if ($old == '') { $old = '999'; } if ($played_more == '') { $played_more = '0'; } if ($played_less == '') { $played_less = '1000000'; } if ($points_more == '') { $points_more = '0'; } if ($points_less == '') { $points_less = '99000000'; } if ($sex == 'Any') { $sex = ''; } if ($from == 'Any') { $from = ''; } $query = "SELECT username, account_id FROM tord_accounts WHERE age > '$young' AND age < '$old' AND country = '$from' AND total_points > '$points_more' AND total_points < '$points_less' AND total_played > '$played_more' AND total_played < '$played_less' and gender = '$sex'"; $result= mysql_query ($query); if (!$result) { die (mysql_error()); } $num_rows=mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $search_username = $row['username']; $search_account_id = $row['account_id']; echo "$search_username ($search_account_id)<br>"; } ?> it doesnt throw any errors out it just doesnt show valid results, also if country is equal to any i want it to search for all counrties but i dont know how i would do that >< Link to comment https://forums.phpfreaks.com/topic/48761-if-this-a-valid-query/ Share on other sites More sharing options...
supanoob Posted April 26, 2007 Author Share Posted April 26, 2007 anyone? Link to comment https://forums.phpfreaks.com/topic/48761-if-this-a-valid-query/#findComment-239375 Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 If you want all countries then omit "country = '' " from the query. Link to comment https://forums.phpfreaks.com/topic/48761-if-this-a-valid-query/#findComment-239386 Share on other sites More sharing options...
supanoob Posted April 26, 2007 Author Share Posted April 26, 2007 is the rest a valid query though? Link to comment https://forums.phpfreaks.com/topic/48761-if-this-a-valid-query/#findComment-239398 Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 Same goes for gender as for country. Link to comment https://forums.phpfreaks.com/topic/48761-if-this-a-valid-query/#findComment-239416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.