title: my select query works in phpmyadmin but not in my code
body: <p>My sql select query  works in phpmyadmin but not working in my php code.Here is my code.Please help me to find a solution.Thank you in advance for your help</p>
  
  <pre><code>    $conn=mysqli_connect("localhost","root","");
      if(!$conn) {
          die(mysqli_error());
      }
      $db=mysqli_select_db($conn,"dbname");
      if(!$db) {
          die(mysqli_error());
      }
      $to_date=$_REQUEST['to_date'];
      $r_date=$_REQUEST['date'];
      $role=$_REQUEST['role'];
      $user_name=$_REQUEST['user'];
      if($_REQUEST['role']='all'||$_REQUEST['role']="") {
          $sql="SELECT * 
                  FROM `daily_log` 
                  WHERE date BETWEEN '$r_date'AND '$to_date'  
                  AND category='Activity'";
      }else{
          $sql="SELECT * 
                  FROM `daily_log` 
                  WHERE category='Activity' 
                  AND assigned_to = '$user_name' 
                  AND date BETWEEN '$r_date' AND '$to_date'";
          echo $sql;
      }
      $exe=mysqli_query($conn,$sql);         
      $i=1;
      while($row=mysqli_fetch_array($exe)) {
          ...table rows..
      }
  </code></pre>