Forums

WHERE STATEMENT not working

zulpaedi 26 Oct, 2011
Dear All,

Hopefully I can get a solution from all of you here, I've got problem with DB multi record loader with where statement. I have a select box 'systems' as input for where clause but the php script I put in where statement seems like not working. Here are my code :
<?php echo "
`systems` LIKE '{$form->data['systems']}'";
?>

['systems'] is my select box field name of my form and `systems` is the column name of my tabel that I would sorting for. But the query result returning zero value.

Could you please any body give me the way to do the query correctly.

Regards,
Zul
GreyHead 27 Oct, 2011
Hi Zul,

How are you getting the value of $form->data['systems'] to be present when the form re-loads? I don't think that happens automatically.

ob
zulpaedi 01 Nov, 2011
Hi Bob,

Thanks a lot for the reply.
I get the $form->data['systems'] when the user click submit button. On submit action I put the DB multi record loader action to display the query result but if I put the dynamic WHERE statement (<?php echo "`systems` LIKE '{$form->data['systems']}'";?>) the query returning zero value. When I put the WHERE statement in static (`systems` LIKE 'system 28') value the query returning all match data. All of this action are in same form the actions I put at on submit action.

Could you please advise me why I never success to sorting the data with dynamic WHERE statement.

Thanks,
Zul
GreyHead 01 Nov, 2011
Hi Zul,

I'm not clear is the DB Multi Record loader in the On Submit event or the ON Load event? If it's the On Load event then you'll need to pass the form data from one form to the next. The Data to Session and SEssion to Data actions are the simplest way to do this.

Bob
zulpaedi 01 Nov, 2011
Hi Bob,

I put the DB Multi Record loader ON Submit event and the form contain with one select box with id "systems". I just want to load the form with data match to "systems" value, but I have never success to sorting the data by dynamic query. What code should I put into where box of DB Multi Record Loader?



Thank you very much.

Regards,
Zul
GreyHead 01 Nov, 2011
Hi Zul,

Hmm, what do you expect it to do in the On Submit event? It's loading data to display and data is displayed in the On Load event.

Bob
zulpaedi 02 Nov, 2011
Hi Bob,

I want when user select the 'systems' select box value then click Submit button and then the data will be displayed sorting by select box value of 'systems' select box. Previously I have succes with this methode but when I try with new computer and Chronoform V4. RC2.0 and I use PHP 5.2.6 version this scrip was not working. Is there is relation between PHP version with chronoforms version?

Regards,
Zul
GreyHead 29 Nov, 2011
Hi Zul,

I don't believe that there is any particular problem with ChronoForms v4 and PHP 5.2.6

You may need to specify an ORDER BY to sort the data as you want it.

Bob
This topic is locked and no more replies can be posted.