PHP
  Home arrow PHP arrow Page 4 - User Authentication With patUser (part 3)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

User Authentication With patUser (part 3)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 6
    2003-05-07


    Table of Contents:
  • User Authentication With patUser (part 3)
  • Making Exceptions
  • The History Channel
  • Natural Selection
  • No Distinguishing Marks
  • Big Brother Is Watching
  • Endgame

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    User Authentication With patUser (part 3) - Natural Selection
    ( Page 4 of 7 )

    You've already seen, in my examination of the getUsers() and getGroups() methods, that you can apply selection criteria (as the second argument to those methods) to return a result subset containing only the records you need. Here's an example:




    <?php $list = $u->getUsers( array("uid", "username"), array( array("field" => "sex", "value" => "F", "match" => "exact") ) ); ?>
    The code snippet above would return a list of only those users who were female.

    There are three components to the second argument in the snippet above: the field, the value, and the selection criteria. The first two are fairly obvious: the "field" key specifies the field against which to match, while the "value" specifies the value against which records are to be compared. The critical element, though, is the third key, "match", which defines how the comparison between the "field" and the "value" will actually be performed.

    patUser permits comparison using any of the following conditions:

    "match" => "exact" field value equals "value" when compared in a case-sensitive manner

    "match" => "greater" field value must be greater than "value"

    "match" => "lower" field value must be lower than "value"

    "match" => "greaterorequal" field value must be greater than or equal to "value"

    "match" => "lowerorequal" field value must be lower than or equal to "value"

    "match" => "contains" field value contains "value"

    "match" => "like" field value equals "value" when compared in a case-insensitive manner

    "match" => "startswith" field value starts with "value"

    "match" => "endswith" field value starts with "value"

    "match" => "between" field value is between the "value" array (x,y)

    The following snippet would return the IDs of all users whose username contains an "e",

    <?php $list = $u->getUsers( array("uid"), array( array("field" => "username", "value" => "e", "match" => "contains") ) ); ?>
    while this one would return usernames and email addresses of all those users who have logged in more than 11 times and are over 18 years old:

    <?php $list = $u->getUsers( array("username", "email"), array( array("field" => "count_logins", "value" => "11", "match" => "greater"), array("field" => "age", "value" => "18", "match" => "greater") ) ); ?>


     
     
    >>> More PHP Articles          >>> More By icarus, (c) Melonfire
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT