Jump to content

if this a valid query


supanoob

Recommended Posts

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.