I have this query that displays all the result in a webpage. My concern is how will I be able to query something that does not exist in the database? For example it will display "no records Yet", if there is no data in the database. Here's my code below.
<?php
           require("script/connect.php");
           $sql = "SELECT
                    COUNT(*)as num
                    FROM
                    users_tbl ";
           $res12 = mysql_query($sql);
              $id = $_GET['id'];
              $sql = "SELECT 
                      teachers_tbl.id,
                      teachers_tbl.teachers_name,
                      users_tbl.teachers_id,
                      users_tbl.A1,
                      users_tbl.A2,
                      users_tbl.A3,
                      users_tbl.A4,
                      users_tbl.A5,
                      users_tbl.A6,
                      users_tbl.A7,
                      users_tbl.A8,
                      users_tbl.A9,
                      users_tbl.A10,
                      users_tbl.B1,
                      users_tbl.B2,
                      users_tbl.B3,
                      users_tbl.B4,
                      users_tbl.B5,
                      users_tbl.B6,
                      users_tbl.B7,
                      users_tbl.B8,
                      users_tbl.B9,
                      users_tbl.B10,
                      users_tbl.C1,
                      users_tbl.C2,
                      users_tbl.C3,
                      users_tbl.C4,
                      users_tbl.comments
                      FROM
                      teachers_tbl
                      INNER JOIN users_tbl ON users_tbl.teachers_id = teachers_tbl.id 
                      WHERE teachers_tbl.id = '$id'";
              $res = mysql_query($sql);
              while($row = mysql_fetch_array($res)){
                if(mysql_num_rows(mysql_query($sql)) != NULL){
                  echo "<p style='text-align:center; color:red;'>NO RECORDS YET.</p>";
                }else{
                  echo "RESULT PAGE FOR  - ".$row['teachers_name']."";
                  include("script/result.php");
                }
              }
          ?>
 
     
     
    