Select fields from multiple sections

5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 30, 2014   (RSS)

By nmsinc - March 23, 2014

I need to include within a select request the field from another section along with those from another - please what I have already that does not work!

<?php $table1Record = mysql_get('member_companies', $ESCAPED_FILTER_VALUE); ?>
SELECT '<?php echo $table1Record['journal_date'] ?>', '<?php echo $table1Record['journal_date'] ?>'  
SELECT title, title
FROM `<?php echo $TABLE_PREFIX ?>journal_dates`

Any ideas on how to make this work?

Thanks - nmsinc

nmsinc

By Chris - March 24, 2014

Hi nmsinc,

I'm not sure what you mean. Can you provide more details and perhaps some examples of your tables and fields?

All the best,
Chris

By Daryl - March 28, 2014 - edited: March 28, 2014

Hi nmsinc,

You're trying to create a select field wherein the list options will come from two different sections, is that correct?

In that case, you can use "UNION" operator, for example:

SELECT timeshare FROM `<?php echo $TABLE_PREFIX ?>membership`
UNION
SELECT types FROM `<?php echo $TABLE_PREFIX ?>claims`

These will give you a list options of values from "timeshare" followed by values from "types".

Hope this helps you to get started on creating your list options.

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com

By nmsinc - March 30, 2014

Thanks Daryl - I will give this a try!

nmsinc