user200
user200

Reputation: 301

IN clause is not working properly in MYSQL php

I have a sql query like this

$statusData = $DB->get_records_sql("SELECT id, element, value FROM {scorm_scoes_track} WHERE scormid = ? AND userid = ? AND element =$DB->get_in_or_equal('cmi.core.lesson_status','cmi.core.total_time')", array($scorm_id, $userid) ); 

So i am trying to fetch the values from query

<?php
$statusData = reset($statusData); 
 if($statusData->element == 'cmi.core.lesson_status') 
$status = $statusData->value ; 
elseif($statusData->element == 'cmi.core.total_time') 
 $totaltimes = $statusData->value ;

but its just showing only status value..it's not showing total time value..Can any one help me

Thanks in advance..

Upvotes: 0

Views: 56

Answers (1)

Shadow
Shadow

Reputation: 34231

You do not have any in operator in your code, so there is nothing that could work at all as an in!

Replace the = with in and remove the moodle call as well as shown below:

...AND element IN ('cmi.core.lesson_status','cmi.core.total_time')

Upvotes: 1

Related Questions