if(isset($_GET['open'])){
    $sub_id = $_GET['open'];
    $sub_query = "SELECT * FROM `forum_sub` WHERE s_id = $sub_id";
    $sub_run  = mysqli_query($connection, $sub_query); 
    $sub_row  = mysqli_fetch_array($sub_run);
    $sub_name = $sub_row['title']; 
    }
/*** 
 * Error starts here: 
 ***/
$topic_query = "SELECT * FROM `forum_topic` WHERE categories = $sub_name";
$topic_run = mysqli_query($connection, $topic_query);
/***  
 * Note also here:
 ***/
 while($topic_row = mysqli_fetch_array($topic_run)){ 
       $p_id = $topic_row['id'];
       $p_title = $topic_row['subject'];
       $p_msg =$topic_row['msg'];
       $p_date = $topic_row['date'];
       $p_username = $topic_row['u_name'];
       $p_view = $topic_row['view'];
      }
When I Remove WHERE then it is okay otherwise it gives error
Please help me
I tried every way but it just not happening. if I remove WHERE tag then it is happening properly