Re: QuickFom question



IchBin wrote:
Markus Ernst wrote:
IchBin schrieb:

I am new to PHP. I am trying to create a QuickForm Select element and load it from a database with 'HTML_QuickForm::LoadQuery'.

I figured it would be a lot easier than build all of that code by hand. The only thing is I can not find much info on using these objects. I can not read the manual for this as I can for Java API's. I am able to display the Select object with label but no data.

Can some one point me in the right direction? I am missing something stupid..

This is the code sniplet:

$form = new HTML_QuickForm();
$s =& $form->createElement('select','name','Catagory:' );
$s->loadQuery($conn, 'select id, name from catagory order by name',

You are sure it is 'catagory', not 'category'?
^ ^

Markus

Nice catch but unfortunately my misspelling is consistent in the column name. I wish their were examples across the internet so I can understand this function. I have only found one reference to 'HTML_QuickForm::LoadQuery'. I guess I could try 'HTML_QuickForm::loadDbResult' but I am not using the DB abstraction currently in my program.

Is there a place where the author answers questions about their PEAR classes. Again I am new to PHP and I am a Java programmer learning PHP.

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

For some reason I can get the 'HTML_QuickForm::loadDbResult' to work but not the 'HTML_QuickForm::loadQuery'. I rather use the loadQuery because it takes less code on my part. Beats me!

//
// This works for HTML_QuickForm::loadDbResult()
$db =& DB::connect($dsn, $options);
if (PEAR::isError($db)) {
die($db->getMessage());
}
$result =& $db->query($catagory_dropdown_select);

if (PEAR::isError($result)) {
die($res->getMessage());
}
$form = new HTML_QuickForm();
$s =& $form->createElement('select','name','Catagory:' );
$s->loadDbResult($result, 'name', 'id');
$form->addElement($s);
$form->display();

I love HSQLDB and use in my Java code. I guess I'll use MySQL for PHP. I am not a big fan of MySQL but it easy to use and 95% of Hosting sites seem to run it..

Problem example: I noticed that when I do an 'ORDER BY' on my 'SELECT' statement this is the screwed-up ORDER that it comes back for 'Catagory':

ApacheTomcat
.Net
AJAX
Buddhist
C and C++
C Sharp
Cisco
CSS
DataBase
Design Patterns
.
.


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
.



Relevant Pages

  • Re: QuickFom question
    ... Again I am new to PHP and I am a Java programmer learning PHP. ... -William E. Taylor, Regular Guy ... I am not a big fan of MySQL but it easy to use and 95% of Hosting sites seem to run it.. ...
    (comp.lang.php)
  • Re: asp, php or java, .net or what?
    ... I only do php and mysql, but recently someone told me that these are ... Java has greater support for other ... Many hosts offer the option of LAMP+IIS ...
    (alt.html)
  • Re: plz help:store googles news on local system and search for it
    ... I'd say Java is a bit overkill, I'd use PHP to do it. ... "PHP and MySQL Web Development" by Luke Welling and Laura Thomson ... the search engine specifics because it's all done for you. ...
    (alt.internet.search-engines)
  • reliable hosting company
    ... java servlet(private tomcat), php and mySql. ...
    (comp.lang.java.programmer)
  • Re: I am totally stumped..with this on..LOAD_FILE Mysql+PHP= FSCK!!
    ... What I am trying to do is to upload files and stuff them in a mysql database. ... I copied the temporary file to somewhere else, and then handed it to MySQL..THAT WORKED.. ... Is there a way to force a close on the file..maybe that's the problem Mysql is opening a file that is not flushed to disk maybe? ... I gew the feeling its maintaining its own picture of file objects, and doesn't actually flush to the disk unless you do a copy or close php.. ...
    (comp.lang.php)