Showing posts with label Ajax. Show all posts
Showing posts with label Ajax. Show all posts

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

Jquery Ajax()

Jquery Ajax Perform Async., HTTP Ajax Request.


jQuery.ajax(url,[settings])
Jquery Ajax
Jquery Ajax()

Url

A string containing the URL to which the request is sent.

Jquery Ajax simple Code:


context

$.ajax({
  url: "test.html",
  context: document.body
}).done(function() {
  $( this ).addClass( "done" );
});

another example:

var jqxhr =
    $.ajax({
        url: "/test.html",
        data: {
            name : "The name",
            desc : "The description"
        }
    })
    .done  (function(data, textStatus, jqXHR)        { alert("Success: " + response) ; })
    .fail  (function(jqXHR, textStatus, errorThrown) { alert("Error")   ; })
    .always(function(jqXHROrData, textStatus, jqXHROrErrorThrown)     { alert("complete"); })
    ;


Disclaimer: Not all these snippet are written by me. Some of them are collected from other sources on Internet.



Books Will Give More Knowledge - Purchase Books