Such is the request

$month = $_GET['month']; $day = $_GET['day']; $sql = mysql_query('SELECT * FROM client WHERE month = "'.$month.'" and day = "'.$day.'"') or die (mysql_error()); while($r = mysql_fetch_array($sql)){ print"<br><b>Результат:</b> <a href=../index.php?option=content&task=view&id=".$r['url'].">".$r['name']."</a>"; } 

I think you understand the result. client.php?month=1&day=22 displays the names of clients for the month of January, the 22nd day. And how to make it so that the client.php?month=1 link client.php?month=1 , so that all clients for January are displayed?

    1 answer 1

    Prepare a query depending on whether the variable $ _GET ['day'] is set or not:

     $month = (int)$_GET['month']; $day = (int)$_GET['day']; $query = "SELECT * FROM client WHERE month = '$month'"; if($day != 0){ $query .= " AND day = '$day'"; } // Выполняем запрос $sql = mysql_query($query); // и так далее ...