PHP database while loop value alphabetically view

PHP database while loop value alphabetically view


PHP database while loop value alphabetically view
PHP database while loop value alphabetically view

Today Discussed PHP database while loop value alphabetical Order view how to display this task is view looks nice view and order based view a database value flows this code.

mysql queris: 

$query = "SELECT `primaryid`,`fieldname`,LEFT(`fieldname`, 1) AS `first_char` FROM tbl_name WHERE (UPPER(`fieldname`) BETWEEN 'A' AND 'Z' OR `fieldname` BETWEEN '0' AND '9') ORDER BY `fieldname`"
$queryresult = mysql_query($query);                                          $current_char = '';
                                                                           while ($row = mysql_fetch_assoc($queryresult)) {                       if ($row['first_char'] != $current_char) {
                        $current_char = $row['first_char'];

                        echo '<div class="clearfix"></div><h1>' . strtoupper($current_char) . '</h1>' . '<br />-----<br />';
                    }                                                     <?php echo stripslashes($row['fieldname']); } ?>
Copy and Paste this code this code is example modify queriys field name is your database table current fieldname and tbl_name is your database table name just replace this field. and another part of code is whill loop displaying looping function try this code and more example click here
PHP database while loop value alphabetically view Dev2Tricks 5 of 5
PHP database while loop value alphabetically view PHP database while loop value alphabetically view Today Discussed PHP database...

Share this

Related Posts

Previous
Next Post »