HTML_Quickform_select
| From: | Mercedes Marín Morán | Date: | Mon, 24 May 2004 15:34:09 +0000 |
| Subject: | HTML_Quickform_select | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12702@lists.php.net to get a copy of this message | ||
Hello list!
This is my first mail in this list. Sorry for my english. I'll try to be clear in my question.
I want to create a select control with option loaded from sql select of a table. something like
this:
$name = 'book';
$label = 'Book Name';
$conn = 'mysql://usuario1:clave1@localhost/library_db';
$sentence = 'select title, id from books';
$myQF->addElement('select', $name, $label, $conn, $sentence);
where $myQF is a HTML_Quickform i create before. With that code, my select control appears empty in
my page. The connection is ok because I used some other controls and they show the correct data.
More than that if I execute the sentence and pass DB_result as a parameter of AddElement, like this
$retrieve = $db->query($sentence); // $db was define and connected using $conn
$myQF->addElement('select', $name, $label, $retrieve);
then it works! The select control shows the titles I have in my book table!!
The problem is solved with this second option, but I want to learn. What is wrong with the first
option?
One last question, please can anybody suggest me a spanish pear list? I can read english but write
is to hard for me.
Thanks a lot