DataOjbects to QuickForms and Back

From: Date: Tue, 19 Oct 2004 14:43:54 +0000
Subject: DataOjbects to QuickForms and Back
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14972@lists.php.net to get a copy of this message
I have setup DataObjects to query my database and all. I tell it what "id" ( its the prim key ) to use and then use the find() then the fetch() commands. Then I use the setDefaults() command in QuickForms with the toArray() command of Dataobjects to populate all the fields + set all the defaults for radio buttons and such. ### CODE ### $hud1->nreo_num = $_REQUEST['id']; // Perform the query $hud1->find(); $hud1->fetch(); $form->setDefaults($hud1->toArray()); ### CODE ### Now, is that the correct way to do it.. or did I take a long way around something (It just seemed to easy for some reason, but it works). 2nd question is, after I validate() ( the QuickForms one ), I do.. ### CODE ### $hud1->setFrom($_POST); $hud1->whereAdd('nreo_num = 6000143896'); $hud1->update(); ### CODE ### It runs and my problem is that when it does UPDATE SQL statement, in the "WHERE" section it puts all the old data. IE: where field1 = 'old_data', AND field2 = 'old_data' .. etc etc threw like 40 of the fields, instead of just doing where NREO_num = 'blah'. So the MSSQL complains because I have a few text fields and you cant do a "compare" ( where ) search on those types of fields. Is there somewhere I can tell it just to use the "WHERE nreo_num = ' blah ' .. and not the rest? -- Sal

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