<!--Pre Defined Functions-->  

  

<?php 



    function showDate($dt) 

    {

          $date=date_create();

          date_timestamp_set($date,

          strtotime("$dt"));

          return date_format($date,"j");

    }



    function showMonth($dt) 

    {

          $date=date_create();

          date_timestamp_set($date,

          strtotime("$dt"));

          return date_format($date,"F");

    }





    function showYear($dt) 

    {

          $date=date_create();

          date_timestamp_set($date,

          strtotime("$dt"));

          return date_format($date,"Y");

    }



    function showFullDate($dt) 

    {

          $date=date_create();

          date_timestamp_set($date,

          strtotime("$dt"));

          return date_format($date,"M j, Y");

    }



    function showTime($t) 

    {

          $time=date_create();

          date_timestamp_set($time,

          strtotime("$t"));

          return date_format($time,"g:i a");

    }



    function showClass($con,$classID)

    {



        $cf_sql = "SELECT sid,sclass FROM class WHERE sid='$classID'";

        $cf_run = mysqli_query($con, $cf_sql);

        $cf_rows = mysqli_fetch_assoc($cf_run);



        return $cf_rows["sclass"];

    }



    function showSubject($con,$subjectID)

    {



        $sf_sql = "SELECT sc_id,sc_name FROM subject WHERE sc_id='$subjectID'";

        $sf_run = mysqli_query($con, $sf_sql);

        $sf_rows = mysqli_fetch_assoc($sf_run);



        return $sf_rows["sc_name"];

    }



    function showClassSubjectFromSid($con,$subjectID)

    {



       $sql = "SELECT s.sc_id,s.sc_name,c.sclass FROM subject AS s INNER JOIN class AS c ON s.sc_class_id = c.sid WHERE s.sc_id ='$subjectID'";

        $run = mysqli_query($con, $sql);

        $rows = mysqli_fetch_assoc($run);



        $showCS = array(

          "showClass"=>"$rows[sclass]", 

          "showSubject"=>"$rows[sc_name]"

        );

        return  $showCS;

    }



?>