List Options Advanced Query

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 12, 2012   (RSS)

By concrete - April 11, 2012

I created a checkbox in the cms_accounts table.

I need to detect if it is true or not to display the correct list options for the user.

Here is an example of what im tyring to do.

if ({custom_checkbox}) {

select num, title from cms_table where field = {cms_accounts.num}

} else {

select num, title from cms_table


}

1. What variable should i can to get the value of the checkbox?

2. What variable should i call to get the user id of the currently logged in user?

Re: [concrete] List Options Advanced Query

By Jason - April 11, 2012

Hi,

For both of these, you can use the $CURRENT_USER variable.

I'm assuming you need to do this for the query of a list field?

If, for example, your check box was called "display", you could do something like this:

<?php if ($CURRENT_USER['display']): ?>

select num, title from cms_table where field = '<?php echo $CURRENT_USER['num'];?>

<?php else: ?>

select num, title from cms_table

<?php endif ?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/