Sorting in MySQL query get options

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

By nmsinc - January 28, 2012

I'm using the following in a Get Options MySQL query. I need to SORT by "member_company_name" and not by the the file number. Any help would be appreciated!

Thanks - nmsinc

<?php if ($CURRENT_USER['isAdmin']):?>
<?php
$where = "";
$where = "WHERE member_type = 'Insurance'";
?>
SELECT num, member_company_name
FROM `<?php echo $TABLE_PREFIX ?>member_companies`
<?php echo $where; ?>

<?php elseif (!$CURRENT_USER['isAdmin'] AND $CURRENT_USER['company_type'] == "Independent"): ?>
<?php
$where = "";
$where = "WHERE member_type = 'Insurance'";
?>
SELECT num, member_company_name
FROM `<?php echo $TABLE_PREFIX ?>member_companies`
<?php echo $where; ?>

<?php else: ?>
<?php
$where = "";
$where = "WHERE num = '".$CURRENT_USER['member_company_accounts']."'";
?>
SELECT num, member_company_name
FROM `<?php echo $TABLE_PREFIX ?>member_companies`
<?php echo $where; ?>

<?php endif ?>
nmsinc

Re: [Jason] Sorting in MySQL query get options

By nmsinc - January 30, 2012

Thanks Jason, worked great!
nmsinc