Forums

PHP

This topic is locked

Help with Repeat Region

Posted 24 Sep 2003 17:14:11
1
has voted
24 Sep 2003 17:14:11 Dane Taylor posted:
I've been working on this site for a while. My problem is with the member list area.
If you select the diffrent type of member it returns it alphabetically by company name. In the Emeritus and individual section, I want it ordered by last name. any suggestions.

mysql_select_db($database_nisd, $nisd);
$query_members = sprintf("SELECT * FROM nisd_member WHERE relationship = '%s' ORDER BY relationship ASC", $colname_members);
$query_limit_members = sprintf("%s LIMIT %d, %d", $query_members, $startRow_members, $maxRows_members);
$members = mysql_query($query_limit_members, $nisd) or die(mysql_error());
$row_members = mysql_fetch_assoc($members);

  <table width="103%" border="0" cellpadding="3" cellspacing="3">
    <tr>
      <?php
  do { // horizontal looper
?>
      <td valign="top"><p> 
 <font color="#000099"><strong><?php if ($row_members['relationship'] != "Individual" { echo $row_members['ccompany'];?></strong></font><br>
                <?php } // Hide if field is empty  ?>
      <?php if ($row_members['relationship'] == "Individual" { echo $row_members['fname'];print" "; echo $row_members['lname'];?></strong></font><?php print" ";?><font face="Times New Roman, Times, serif"><?php echo $row_members['class']; ?></font><br>
          
      <?php } // Hide if field is empty  ?>
      <font color="#000099"><strong>
      <?php if ($row_members['relationship'] == "Emeritus" { echo $row_members['fname'];print" "; echo $row_members['lname'];?></strong></font><?php print" ";?><font face="Times New Roman, Times, serif"><?php echo $row_members['class']; ?></font><br>
        
      <?php } // Hide if field is empty  ?></strong></font>
     
 
        <?php if ($row_members['certification'] != ""  { // Hide if field is empty ?>
        <font color="#990000">A <?php echo $row_members['certification'];?> Company</font><br>
        <?php } // Hide if field is empty ?>
         
          <?php if ($row_members['ccompany'] != ""  { // Hide if field is empty ?>
  
          <?php if ($row_members['relationship'] == "Individual"  { echo $row_members['ccompany'];?><br>
        <?php } // Hide if field if company is empty ?>
           <?php } // Hide if field is empty  ?>
           

      <?php if ($row_members['relationship'] == "Associate" || $row_members['relationship'] == "Members At Large"  {  echo $row_members['fname'];print" "; echo $row_members['lname']; print" "; ?><?php print" ";?><?php echo $row_members['class']; ?><br>
      
      <?php } // Hide if field is empty  ?>   

      
        
        <font face="Times New Roman, Times, serif"> <?php echo $row_members['caddress']; ?><br />
        <?php echo $row_members['ccity']; ?> <?php echo $row_members['state']; ?> <?php echo $row_members['czip']; ?><br />
        <?php if ($row_members['ccountry'] != ""  { // Hide if field is empty ?>
        <?php echo $row_members['ccountry']; ?><br>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['cphone'] != ""  { // Hide if field is empty ?>
        phone: <?php echo $row_members['cphone']; ?><br>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['cfax'] != ""  { // Hide if field is empty ?>
        fax: <?php echo $row_members['cfax']; ?><br>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['ciphone'] != ""  { // Hide if field is empty ?>
        international phone: <?php echo $row_members['ciphone']; ?><br>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['cifax'] != ""  { // Hide if field is empty ?>
        International fax: <?php echo $row_members['cifax']; ?><br>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['cemail'] != ""  { // Hide if field is empty ?>
        <a href="mailto:<?php echo $row_members['cemail']; ?>"><?php echo $row_members['cemail']; ?><br>
        </a>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['cweb'] != ""  { // Hide if field is empty ?>
        <a href="<?php echo $row_members['nisd/cweb']; ?>" target="_blank"><?php echo $row_members['cweb']; ?></a>
        <?php } // Hide if field is empty ?>
        <a href="<?php echo $row_members['nisd/cweb']; ?>" target="_blank"> </a></font><font face="Times New Roman, Times, serif"> </font><br>
        <?php if ($row_members['member1'] != ""  { // Hide if field is empty ?>
        <?php echo $row_members['member1']; ?><br>
        <?php }  ?>
        <?php if ($row_members['member2'] != ""  { // Hide if field is empty ?>
        <?php echo $row_members['member2']; ?><br>
        <?php } // Hide if field is empty ?>
        <?php if ($row_members['member3'] != ""  { // Hide if field is empty ?>
        <?php echo $row_members['member3']; ?>
        <?php } // Hide if field is empty - ?> 
        </p>
      </td>
      <?php
    $row_members = mysql_fetch_assoc($members);
    if (!isset($nested_members)) {
      $nested_members= 1;
    }
    if (isset($row_members) && is_array($row_members) && $nested_members++%3==0) {
      echo "<tr></tr>";
    }
  } while ($row_members); //end horizontal looper 
?>
</tr>

  </table>

Replies

Replied 24 Sep 2003 17:28:48
24 Sep 2003 17:28:48 Julio Taylor replied:
can you post your SQL query?

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:
Replied 24 Sep 2003 17:59:59
24 Sep 2003 17:59:59 Dane Taylor replied:
Heres one

SELECT id,fname, lname, relationship, ccompany, caddress, ccity, `state`, czip, ccountry, cphone, cfax, ciphone, cifax, cemail, cweb, certification, `position`, ptitle, class FROM nisd_member WHERE relationship="Members at Large" ORDER BY lname ASC


SELECT id,fname, lname, relationship, ccompany, caddress, ccity, `state`, czip, ccountry, cphone, cfax, ciphone, cifax, cemail, cweb, certification, `position`, ptitle, class FROM nisd_member WHERE relationship="Emeritus" ORDER BY lname ASC

Reply to this topic