
Jason
Staff
/ Moderator

Jan 30, 2012, 10:15 AM
Post #2 of 3
(161 views)
Shortcut
|
|
Re: [nmsinc] Sorting in MySQL query get options
[In reply to]
|
Can't Post
|
|
Hi, You need to add ORDER BY member_company_name to the end of your query like this:
<?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; ?> ORDER BY member_company_name <?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; ?> ORDER BY member_company_name <?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; ?> ORDER BY member_company_name <?php endif ?> Hope this helps --------------------------------------------------- Jason Sauchuk - Programmer interactivetools.com Hire me! Save time by getting our experts to help with your project. http://www.interactivetools.com/consulting/
|