/**
  * Test loadResult method
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testLoadResult()
 {
     $query = $this->object->getQuery(true);
     $query->select('id');
     $query->from('jos_dbtest');
     $query->where('title=' . $this->object->quote('Testing2'));
     $this->object->setQuery($query);
     $result = $this->object->loadResult();
     $this->assertThat($result, $this->equalTo(2), __LINE__);
 }
Exemple #2
0
$the_old_day_order = $ids->days;
$the_old_day_order = explode(';', $the_old_day_order);
$the_old_task_order = $ids->tasks;
$the_old_task_order = explode(';', $the_old_task_order);
$new_daystatus_order = '';
$new_taskstatus_order = '';
foreach ($items as $one_item) {
    //one_item looks like this ->  6-0:false:202:
    $one_item_array = explode(':', $one_item);
    if ($one_item_array[1] == 'false') {
        // saving the new order
        $day_id = $one_item_array[2];
        $sql = " SELECT ordering FROM #__guru_days WHERE id = " . $day_id;
        $database->setQuery($sql);
        $database->query();
        $tmp_ordering = $database->loadResult();
        $old_day_status_array = $the_old_day_order[$tmp_ordering - 1];
        $old_day_status_array_expl = explode(',', $old_day_status_array);
        $new_daystatus_order = $new_daystatus_order . $day_id . ',' . $old_day_status_array_expl[1] . ';';
        if (strlen($the_old_task_order[$tmp_ordering - 1]) > 0) {
            $new_taskstatus_order = $new_taskstatus_order . $the_old_task_order[$tmp_ordering - 1] . ';';
        } else {
            $new_taskstatus_order = $new_taskstatus_order . ';';
        }
    }
}
$sql = "UPDATE #__guru_programstatus \r\n\t\t\t\t\t\tSET days='" . $new_daystatus_order . "',\r\n\t\t\t\t\t\t\ttasks='" . $new_taskstatus_order . "'\r\n\t\t\t\t\t\twhere id='103'";
$database->setQuery($sql);
$database->Query();
$i = 1;
foreach ($items as $one_item) {