Re: [solution] QuickForm_advmultiselect - can you open the form with the SELECTED list already populated from a data set?

From: Date: Tue, 30 Aug 2005 23:00:28 +0000
Subject: Re: [solution] QuickForm_advmultiselect - can you open the form with the SELECTED list already populated from a data set?
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20675@lists.php.net to get a copy of this message
l Burnerheimerton wrote:
I'm not sure how to do this using Pear DB: I've tried the following three methods to get what you said I needed and it still gives my the blank entry in the selected column: $selected_people = $db->getCol("SELECT CONCAT(lastName, \", \", firstName) FROM people WHERE ID = 17"); $selected_people = $db->getOne("SELECT CONCAT(lastName, \", \", firstName) FROM people WHERE ID = 17"); $selected_people = $db->query("SELECT CONCAT(lastName, \", \", firstName) FROM people WHERE ID = 17");
Well it's depends of your database structure, "people" table and what you expected to get once the form will be post. CONCAT(lastName, \", \", firstName) : this part is only the visible content that will be display on both lists (select boxes: AVAILABLE=$all_people, SELECTED=$selected_people). You also need a key (table column) which identity the label CONCAT(lastName, \", \", firstName) itself. remember my example: $all_people = array('farell' => 'laurent laville');
                      (1)            (2)
(1) should be a people.column (not yet present in your query) (2) this content is === CONCAT(lastName, \", \", firstName) i hope WHERE ID = 17 identify a list and not only a single row otherwise you have found the (1) missing. It's definitively now a problem to get information in good format rather than a HTML_QuickForm_advmultiselect bug or wrong implementation. regards Laurent

« previous php.pear.general (#20675) next »