Joomla.it Forum

Non solo Joomla... => Database => : james81 03 Oct 2013, 10:16:39

: Query db J25
: james81 03 Oct 2013, 10:16:39
Ciao a tutti,
ho un problema con questa query :

$db = JFactory::getDBO();
        $query = $db->getQuery(true);
        $query->select('obb_id, det_id');
        $query->from('#__tabella');   
        /*$query->where("obb_id=.'$id'. ");*/
        $results = $db->loadObjectList();
        $db->setQuery((string)$query);
     if ($results){
    foreach($results as $result)
    {

        echo "bbb-".$id."-bbb";
        echo "aaa-".$result->obb_id."-aaa";
        echo "aaa-".$result->det_id."-aaa";

    }
non mi stampa a video i risultati
: Re:Query db J25
: tomtomeight 03 Oct 2013, 14:33:33
Dove e come fai questa query?
: Re:Query db J25
: mau_develop 03 Oct 2013, 15:50:50
        $results = $db->loadObjectList();
        $db->setQuery((string)$query);
----------------------------------------------------
sicuro?
: Re:Query db J25
: giovi 03 Oct 2013, 21:53:32
Che fai prima prelevi l'insieme dei risultati e poi effettui la query?
E' come togliere la tanica da sotto la fontana prima di aprire il rubinetto!  :)

http://docs.joomla.org/Selecting_data_using_JDatabase