Welcome Guest, Not a member yet? Register   Sign In
help me to change mysql code to php
#2

There is no reason why you can't run this query as is:


PHP Code:
// In your model
$this->load->database();

$query $this->db->query('
     SELECT a1.mark_id, a1.student_id,  
     COUNT(a2.quiz) Rank 
     FROM mark a1, mark a2 WHERE a1.quiz < a2.mark_quiz
     OR (a1.mark_total=a2.quiz AND a1.student_id = a2.student_id) 
     GROUP BY a1.student_id, a1.quiz ORDER BY a1.quiz DESC, a1.student_id DESC
'
);

if( 
$query->num_rows() > )
{
     // Do something with $result ...
     $result $query->result();

Reply


Messages In This Thread
help me to change mysql code to php - by kira - 06-07-2017, 01:57 AM
RE: help me to change mysql code to php - by skunkbad - 06-07-2017, 04:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB