Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to calculate position of student in class in laravel

$stclass = $request->get('stclass');
        $myclass = Stclass::find($request->get('stclass'))->name;
        $studentId = $request->get('studentId');
        $studentname = Student::find($request->get('studentId'))->surname;

        $session= $request->get('sessionnow');
        $term = $request->get('term');

        $myids = Stclass::find($stclass)->students;
      
        // $dodo = DB::table('results')
        //           -> where('studentClass', $stclass)->where('session', $session)->where('term', $term)
        //           ->selectRaw('results.studentId')->distinct()->get();

          

                
                  
      

         $resultpercent = DB::table('results')
                  -> where('studentClass', $stclass)->where('session', $session)->where('term', $term)->where('studentId', $studentId)
                  ->selectRaw("SUM((results.exam + (results.test1 + results.test2)/2)/2)/(COUNT(results.subject)) as overallpercent")->get();

                   $dodo = DB::table('results')
                  -> where('studentClass', $stclass)->where('session', $session)->where('term', $term)
                  ->selectRaw('results.studentId')->get();

                

         $results = DB::table('results')
                    ->where('studentClass', $stclass)->where('session', $session)->where('term', $term)->where('studentId', $studentId)
                    ->selectRaw('results.*, (results.test1 + results.test2)/2 as cav, (results.exam + (results.test1 + results.test2)/2)/2 as totalmark')->get();

      return view('admin.results.studentresultsheet', compact('results', 'myclass', 'studentname','resultpercent', 'countsubjects'));
Comment

PREVIOUS NEXT
Code Example
Php :: Remove Version from CSS and JS 
Php :: type declaration php 
Php :: laravel How do I chain multiple where and orWhere clause in laravel from an Array [duplicate] 
Php :: elasticsearch php filter range 
Php :: utf8mb4 decode in php 
Php :: php slots 
Php :: php check if variable is resource 
Php :: laravel remove public from url htaccess 
Php :: laravel event on attribute chang 
Php :: how i can send by database table in laravel full calendar 
Php :: check if product has crosssell woocommerce 
Php :: PHP detect spam name 
Php :: wp php get product attribute name without pa 
Php :: ubuntu PHP Installation broken - shows strange php code as response 
Php :: obtener tipo 
Php :: Change Initial Country For Caldera Forms Phone Fields 
Php :: How to hide tax details from woocommerce order emails 
Php :: Input sanitization to prevent XSS 
Php :: Uncaught TypeError: call_user_func(): Argument #1 
Php :: cache.backend.null 
Php :: Cakephp api POST request , saving data without validation 
Php :: small echo php 
Php :: laravel validate form data unique array 
Php :: wp wc php change customer shipping country for all users 
Php :: Deactivate click events on product card image, title and contents 
Php :: customly add reviews from code site reviews wp 
Php :: load more data on button click in laravel 
Php :: iterate over assets container statamic 
Php :: function placing bet in guide using php 
Php :: run seeder command in laravel 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =