fork download
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Langdon
  5.  * Date: 08.03.16
  6.  * Time: 15:02
  7.  */
  8. include(ROOT.'/components/Db.php');
  9. class Student {
  10.  
  11. public static function getStudentList(){
  12. $db = Db::getConnection();
  13.  
  14. $StudentList = array();
  15. $result = $db->query("SELECT * FROM studets ORDER BY marks DESC");
  16.  
  17.  
  18. $i = 0;
  19. while($row = $result->fetch()){
  20.  
  21. $StudentList[$i]['firstName'] = $row['firstName'];
  22. $StudentList[$i]['secondName'] = $row['secondName'];
  23. $StudentList[$i]['number'] = $row['number'];
  24. $StudentList[$i]['marks'] = $row['marks'];
  25. $i++;
  26. }
  27.  
  28. return $StudentList;
  29. }
  30. }
Success #stdin #stdout #stderr 0.03s 52480KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Use of undefined constant ROOT - assumed 'ROOT' in /home/RSePTe/prog.php on line 8
PHP Warning:  include(ROOT/components/Db.php): failed to open stream: No such file or directory in /home/RSePTe/prog.php on line 8
PHP Warning:  include(): Failed opening 'ROOT/components/Db.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/RSePTe/prog.php on line 8