Re: $this-Model-variable, read

2007-09-27 Thread Antonio Cortés
Try the FindBy[Field] method ;-)

  function profile($username) {
 $this-set('user', $this-User-findByUsername( $username ));
   }





2007/9/27, Travis [EMAIL PROTECTED]:


 I am trying to gather profile information in my users controller by
 using this function:

function profile($username) {
  $this-User-username = $username;
  $this-set('user', $this-User-read());
}

 However, when I visit http://localhost/users/profile/
 username_goes_here the query returns:

 SELECT `User`.`id`, `User`.`username`, `User`.`password`,
 `User`.`first_name`, `User`.`last_name` FROM `users` AS `User` WHERE
 `User`.`id` = 'username_goes_here' LIMIT 1

 How can I make it search for the username and not the ID?


 Antonio Cortés (Dr Zippie)

 El ordenador es la evolucion logica del hombre: Inteligencia sin moral:
 John Osborne.
 A nullo videbatur, ipse autem omnia videbat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$this-Model-variable, read

2007-09-26 Thread Travis

I am trying to gather profile information in my users controller by
using this function:

function profile($username) {
  $this-User-username = $username;
  $this-set('user', $this-User-read());
}

However, when I visit http://localhost/users/profile/
username_goes_here the query returns:

SELECT `User`.`id`, `User`.`username`, `User`.`password`,
`User`.`first_name`, `User`.`last_name` FROM `users` AS `User` WHERE
`User`.`id` = 'username_goes_here' LIMIT 1

How can I make it search for the username and not the ID?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---