Support » Fixing WordPress » Alphabetize Directory

  • I’m trying to alphabetize this result by physician name and cannot figure it out:

    <?php
    $sql = “select * from wp_physician where (physician_name like ‘%”.$_GET[“ph”].”%’ and specialities like ‘%”.$_GET[“ss”].”%’ and location_name like ‘%”.$_GET[“pn”].”%’ and o_address like ‘%”.$_GET[“sn”].”%’) and usertype=’physician'”;
    $result = mysql_query($sql);
    while($row=mysql_fetch_array($result)) {
    extract($row);
    $specialities = str_replace(“,”,”, “,$specialities);
    ?>

    <tr height=”35″>
    <td style=”vertical-align: top;padding: 10px 5px 0 5px;border-right: 2px dotted #AAA;” width=”210″><h2>“><?php echo $physician_name;?></h2></td>
    <td width=”10″></td>
    <td style=”padding:10px 5px 0 5px;border-right: 2px dotted #AAA;” width=”300″> <div class=”post_bottom”>
    <span><?php echo $specialities;?></span></div></td>
    <td width=”10″></td>
    <td style=”padding:10px 5px 0 5px;border-right: 2px dotted #AAA;” width=”125″><p><?php echo $o_address;?></p></td>
    <td style=”vertical-align: top;padding:10px 5px 0 5px;” width=”10″>“>View More</td>
    </tr>
    <?php } ?>

Viewing 1 replies (of 1 total)
  • Can you just add ‘ORDER BY physician_name ASC’ to the sql?

    <?php
    $sql = "select * from wp_physician where (physician_name like '%".$_GET["ph"]."%' and specialities like '%".$_GET["ss"]."%' and location_name like '%".$_GET["pn"]."%' and o_address like '%".$_GET["sn"]."%') and usertype='physician'
    ORDER BY physician_name ASC";
Viewing 1 replies (of 1 total)
  • The topic ‘Alphabetize Directory’ is closed to new replies.