Yii Framework Forum: validation Check - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

validation Check Rate Topic: ***** 1 Votes

#1 User is offline   Programming_freak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 08-January 10

Posted 13 January 2010 - 03:49 AM

I am using the following code to check whether the username already exists

Here User is one model and i am accessing data from table 'user'.

Can anyone tell me wats wrong in the code...why its not echoing the result
I checked everything fine till criteria part.
some thing wrong with accessing data.

function checkUserName($username) {

    $mod = new User;
    $criteria = new CDbCriteria;
    $criteria->condition = "UserName=:UserName";
    $criteria->params = array(":UserName"=>$username);
    
    $mod = $mod->findAll($criteria);
    echo $mod->UserName;
    die();
  }

0

#2 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 13 January 2010 - 05:45 AM

duplicated http://www.yiiframew...600-validation/
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users