Page 1 of 1

Problem mit der stdClass

Posted: Thu Jan 31, 2008 2:33 pm
by felixg
Hallo erstmal,

ich versuche grade mit einem DB Inhalt einen DropDownListe zu erstellen.
Dies mache ich mit folgendem Code:

Code: Select all

$national = array();
$query = "SELECT * FROM ".cms_db_prefix()."module_wsnational ORDER BY id";
$dbresult = $db->Execute($query);




while ($dbresult && $row = $dbresult->FetchRow())   

{
  $onerow = new stdClass();
  $onerow->id = $row['id'];
  $onerow->name = $row['name'];
  print_r($onerow);
  $national[] = $onerow;
}           

      
    $this->smarty->assign('prompt_national', $this->Lang('national'));
    $this->smarty->assign('input_national',
        $this->CreateInputDropdown($id, 'input_national', 
              $national, -1, ''));
Die sollte eigentlich funktionieren. Aber es kommt folgender Fehler.

Catchable fatal error: Object of class stdClass could not be converted to string in I:\xampp\htdocs\cms\lib\classes\module_support\modform.inc.php on line 303

Ich benutzt die Black Rock Version 1.2.3.

Hoffe es kann wer helfen....

lg

felixg

Re: Problem mit der stdClass

Posted: Thu Jan 31, 2008 10:28 pm
by cyberman
Bin zwar kein Programmierer, aber sollte das nicht so aussehen ::)?

Code: Select all

    $smarty->assign('prompt_national', $this->Lang('national'));
    $smarty->assign('input_national',
        $this->CreateInputDropdown($id, 'input_national', 
              $national, -1, ''));

Re: Problem mit der stdClass

Posted: Fri Feb 01, 2008 1:28 pm
by felixg
Ne, daran lag es nicht...