Hello,
I dunno what I have done but now it works very vell.
sry for wasting your time!!
Enjoy,
Dominik
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"C
I suggest you turn on debug and print out what is returned from the
query, because the query is going straight to the database - CakePHP
is not doing anything to it! So what you see in your debug information
in your first post is not related to this query!
What your first post debug information
Hey my complete function is:
$user = $this->Auth->user();
$this->Planet->recursive = 0;
$planets = $this->Planet->query("SELECT *
FROM planets AS Planet
LEFT OUTER JOIN buildings AS
Building
We need more information! How are you realizing your query - are you
using CakePHP models find or query method?
Please show the code where you are using your query!
Enjoy,
John
On Mar 31, 6:18 pm, Dominik Kukacka wrote:
> Hey everyone,
>
> i tried to make an join query on two tables!
>
> my qu
Hey everyone,
i tried to make an join query on two tables!
my query is:
SELECT *
FROM planets AS Planet
LEFT OUTER JOIN buildings AS Building ON (Planet.id =
Building.planet_id)
WHERE Building.user_id=1;
so, the query works well in my PMA and in Workbench (CL),
but in cakePHP it ma
You can to use something as
$this->Model->updateAll(array('Model.field +=' =>'Model.field', array
('Model.id' => '$id');
On 17 jan, 23:15, Saleh Souzanchi wrote:
> how to execute this query with cakephp :
>
> update table_name
//bin.cakephp.org/view/429049354
>
> On Jan 18, 2:52 am, Saleh Souzanchi wrote:
>
> > Is there another way?
>
> > On Jan 18, 4:46 am, Jon Bennett wrote:
>
> > > > how to execute this query with cakephp :
>
> > > > update table_name set hit = hi
Afaik not thats why I wrote this function for in my appModel a while
ago: http://bin.cakephp.org/view/429049354
On Jan 18, 2:52 am, Saleh Souzanchi wrote:
> Is there another way?
>
> On Jan 18, 4:46 am, Jon Bennett wrote:
>
> > > how to execute this query with cak
Is there another way?
On Jan 18, 4:46 am, Jon Bennett wrote:
> > how to execute this query with cakephp :
>
> > update table_name set hit = hit+1
>
> $this->Table->query('update table set hit = hit+1);
>
> j
>
> --
> jon bennett -www.jben.net- bl
> how to execute this query with cakephp :
>
> update table_name set hit = hit+1
$this->Table->query('update table set hit = hit+1);
j
--
jon bennett - www.jben.net - blog.jben.net
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakeP
how to execute this query with cakephp :
update table_name set hit = hit+1
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To po
Try the Ad-hoc joins:-
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php
ot
> Robot belongsTo User
>
> I want to get related robots based on his tags. More tags in common,
> more related.
>
> So, whats the way to put this query using $this->Robot->find(...) or
> $this->Robot->RobotsTag->find(...)
>
> SELECT count(tag_id) as to
Robot HABTM Tag
User hasMany Robot
Robot belongsTo User
I want to get related robots based on his tags. More tags in common,
more related.
So, whats the way to put this query using $this->Robot->find(...) or
$this->Robot->RobotsTag->find(...)
SELECT count(tag_id) a
Well, I solved my issue making the query with SELECT COUNT(*) to get
the selected rows.
Thanks for your advices
On 2 abr, 10:28, keogh wrote:
> Thanks Reggie, but the problem is that I have to use CakePHP v1.1.x,
> so I need a way to do that query in CakePHP or I need to do the query
> but it s
Thanks Reggie, but the problem is that I have to use CakePHP v1.1.x,
so I need a way to do that query in CakePHP or I need to do the query
but it should return only the affected rows or a resource type which I
can use it to know the affected rows, I don't want that the query
return the data.
Than
Thanks Reggie, but the problem is that I have to use CakePHP v1.1.x,
so I need a way to do that query in CakePHP or I need to do the query
but it should return only the affected rows or a resource type which I
can use it to know the affected rows, I don't want that the query
return the data.
Than
I don't know for CakePHP v1.1.x. However, if you use CakePHP v1.2.2 -
-- Here is the User Model
array(
'foreignKey'=>false,
'type'=>'INNER',
'conditions'=>array('Page.user_id=User.id'),
ilike '%$variable%'
AND pages.page_status = '1' AND pages.allow_page = '1' ORDER BY
users.last_name ASC LIMIT $limit OFFSET $offset
Where $variable, $limit and $offset are variables. I would like to
know how can I make this query in CakePHP 1.1.x using the functions
This is what I came up with, I dont know if theres another solution.
Also im completely lost how to paginate this.
function getMyFriends($user_id, $status = 'approved', $limit = 5) {
$friends = $this->find('all', array(
'fields' => array('Friend.*')
I got something working on this but I ran into a problem. When joining
the user table to the friend data, I dont know if its the friend_id or
the user_id. So I will have to do some filtering and extra queries
after i grab all friends.
--~--~-~--~~~---~--~~
You recei
Assuming that translates to:
SELECT
Friend.*,
User.username,
User.avatar,
User.handler
FROM
friends AS Friend,
INNER JOIN users AS User
ON User.id = Friend.user_id
WHERE
Friend.status = 'approved' AND
(
(Friend.user_id = ':us
Snippets of the code:
CREATE TABLE IF NOT EXISTS `friends` (
`user_id` int(10) unsigned NOT NULL,
`friend_id` int(10) unsigned NOT NULL,
`status` enum('approved','pending') NOT NULL default 'pending',
`requestTime` int(10) NOT NULL,
KEY `user_id` (`user_id`),
KEY `friend_id` (`friend_
What do your tables, models and controllers look like?
-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of gearvOsh
Sent: Saturday, December 27, 2008 7:48 PM
To: CakePHP
Subject: How would I write this query
Im a bit new to the model
Im a bit new to the model system, trying to understand how I would do
a query like so.
SELECT Friend.*, User.username, User.avatar, User.handler FROM friends
AS Friend, users AS User WHERE Friend.status = 'approved' AND
((user_id = ':user_id') OR (friend_id = ':user_id')) AND User.id =
Friend.use
I would do something like (note that you'll need to modify to fit your
data model and field names):
$posts_w_tags = $this->Post->Tag->find('all',
array(
'conditions' => array(
Hi Kyle,
Here's a function you could try in your Post model ->
http://bin.cakephp.org/view/607120740
I've given it a default of 5 tags if called with no params. Obviously
you can change this to suit or override it when you call it from your
controller.
e.g. $this->Post->postCountByTagCount(2)
Tags are in their own table. They are associated to the blog model via
a HABTM relationship.
On Dec 27, 2:41 am, gearvOsh wrote:
> How is your database setup? Are tags a column in the blog table or is
> it its own table?
--~--~-~--~~~---~--~~
You received this mes
How is your database setup? Are tags a column in the blog table or is
it its own table?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
T
I'm trying to write a query that finds how many blog posts have more
then x number of tags. Could anyone provide me with an example of how
to do this? I would be most grateful.
Thank you as always.
--~--~-~--~~~---~--~~
You received this message because you are
Funny, your original SQL said NOT NULL, maybe that was your
problem ;-)
On Dec 18, 2:07 pm, Ramiro Araujo wrote:
> Hah, yes I see. thanks for the response.
>
> btw, I need i.id IS NULL, not IS NOT NULL
>
> On Dec 18, 7:59 pm, AD7six wrote:
>
> > On Dec 18, 9:50 pm, Ramiro Araujo wrote:
>
> > >
Hah, yes I see. thanks for the response.
btw, I need i.id IS NULL, not IS NOT NULL
On Dec 18, 7:59 pm, AD7six wrote:
> On Dec 18, 9:50 pm, Ramiro Araujo wrote:
>
>
>
> > no, I'm trying stuff like this:
> > $data = $this->User->find('all',
> > array(
> > 'fields' => arra
OK!! got it working!
Here it is:
$this->User->unbindModel(array('hasMany' => array('Invitation')));
$this->User->bindModel(array('hasOne' => array('Invitation')));
$data = $this->User->find('all',
array(
'fields' => array('User.*', 'Invitation.*'),
'condit
On Dec 18, 9:50 pm, Ramiro Araujo wrote:
> no, I'm trying stuff like this:
> $data = $this->User->find('all',
> array(
> 'fields' => array('User.*', 'Invitation.*'),
> 'conditions' => array(
> 'Invitation.id' => NULL
>
On Dec 18, 8:27 pm, Kyle Decot wrote:
> I have a Skateparks Model and a Photos Model. I want to query the
> Skateparks model and get the number of skateparks that have 1 photos,
> 2 photos, etc. I'm not really sure how to go about this.
>
> Any help would be greatly appreciated. Thank you.
you
no, I'm trying stuff like this:
$data = $this->User->find('all',
array(
'fields' => array('User.*', 'Invitation.*'),
'conditions' => array(
'Invitation.id' => NULL
),
'limit' => 100,
Probably a dumb question, but did you try a NOT condition on your
find?
array ("not" => array (
"Invitation.id" => null,
)
)
http://book.cakephp.org/view/74/Complex-Find-Conditions
On Dec 18, 10:58 am, Ramiro Araujo wrote:
> Hi all
>
> I wasn't really fond to the find method bef
The cake way is to do a find('count'), so you'd do something like
$this->Skatepark->Photo->find('count')
http://book.cakephp.org/view/449/find
Alternatively, you can cheat and use a correlated sub-query as one of
your fields in the find, although I'm sure this violates all sorts of
Cake principl
I have a Skateparks Model and a Photos Model. I want to query the
Skateparks model and get the number of skateparks that have 1 photos,
2 photos, etc. I'm not really sure how to go about this.
Any help would be greatly appreciated. Thank you.
--~--~-~--~~~---~--~~
Hi all
I wasn't really fond to the find method before, and made a lot of
custom query()ies. Now im using it a lot, with quite nice results.
Still, im having trouble trying to build a query. Let me explain the
situation.
I have 2 tables: a users table, and a invitations table. User hasMany
Invita
The array doesn't really look odd, it's doing exactly what Cake
normally does and encapsulating results in an array.
If I had to guess it would probably be due to the way your model is
structured, and how Cake is building the SQL based on the data you are
giving it.
Look at the generated query (
I think this is because it's nigh on impossible to determine the table
that a function, like COUNT or SUM etc, is getting its data from.
For more information and some work-arounds, see:
http://groups.google.com/group/cake-php/browse_thread/thread/2fa2cd69422dfcf/81e7a5ea50266a15
On Dec 11, 4
The keywords query in the view() function is returning the following
array:
Array ( [Hit] => Array ( [keyword] => banana ) [0] => Array ( [count]
=> 1 ) )
I am going for: Array ( [Hit] => Array ( [keyword] => banana, [count]
=> 1 ) )
class ItemsController extends AppController
{
var $nam
/ Fields should contain '((something)) AS Model__field'
>>
>> Hope this helps.
>>
>> On 15 Oct 2008, at 02:59, Dérico Filho wrote:
>>
>>
>>
>>> Hello guys,
>>
>>> So I asked a question about having clauses using $this-&
t;
>
>
> > Hello guys,
>
> > So I asked a question about having clauses using $this->Model->find()
> > method, and the answer was daunting, in my opinion: use in Model Class
> > $this->query() method within a custom method... OK. I shall do it this
> >
ld'
Hope this helps.
On 15 Oct 2008, at 02:59, Dérico Filho wrote:
>
> Hello guys,
>
>
> So I asked a question about having clauses using $this->Model->find()
> method, and the answer was daunting, in my opinion: use in Model Class
> $this->query() method within a
Use Set classs for manipulating your find's results, particularly the
Set::combine method maybe helpful for you..
http://book.cakephp.org/view/662/combine
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" gr
Hello guys,
So I asked a question about having clauses using $this->Model->find()
method, and the answer was daunting, in my opinion: use in Model Class
$this->query() method within a custom method... OK. I shall do it this
way.
One of the problems I face using $this->query() is:
ah ok tnx fixed that, any help on my last post for inserting the $ret
data returned from
the tasklist model into the tasklist controller's $this->data ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" gro
You've got $taklist_data and (later) $tasklist_data
On Jul 31, 2:17 pm, rtanz <[EMAIL PROTECTED]> wrote:
> why is it a typo?
function beforeSave() {
$taklist_data = $this->Tasklist->query("SELECT
`memberships`.`module_id`, `memberships`.`user_id`, `tasks`.`id`as
task_id
$this->set('tasks',
$this->Tasklist->Task->generateList());
$this->set('users',
$this->Tasklist->User->generateList());
}
}
}
Tasklist model:
fu
in.cakephp.org/view/1697492973
>
> this is the part where im getting confused. as far as i can see i need
> to use the beforeSave function in the Membership model in order to
> trigger this creation of a new record in the tasklist model. however i
> am not sure in what way to do this. s
getting confused. as far as i can see i need
to use the beforeSave function in the Membership model in order to
trigger this creation of a new record in the tasklist model. however i
am not sure in what way to do this. should i put this query code in
say tasklist::addtasklist and then call that
A Membership belongsTo User hasOne TaskList from what I can see. Once
you have your associations set up properly try $this->User->TaskList
Make sure the associations are set up correctly. You cannot call
arbitrary members and just pray that CakePHP will figure out what you
mean. It's good but
why is it a typo?
--~--~-~--~~~---~--~~
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
Try fixing that typo on 9, first. ; )
--~--~-~--~~~---~--~~
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 [
well that is my problem, how should i go about doing this? the
Tasklist model itself is not really related to the Membership model.
The thing is that when a User is given Membership to a Module, I would
like to build a Tasklist for that user (a to do list of things he has
to do within this member
On 7/31/07, rtanz <[EMAIL PROTECTED]> wrote:
> ERROR:
> Notice: Undefined property: Membership::$Tasklist in W:\www\cake\app
> \models\membership.php on line 9
>
> Fatal error: Call to a member function query() on a non-object in W:
> \www\cake\app\models\membership.php on line 9
>
>
> >
>
Where
hi i am trying to perform an sql query but am getting an error. This
is my membership model, as the action will be triggered whenever a new
membership is created. Then i will like to pull the data shown in the
sql query and save that in the Tasklist model. here is the code and
error:
Tasklist->qu
Hello everyone !
My intentions:
- to get a (kind of) sequence nr for naming an object
- (maybe) save someone a headache
My (first) approach was to use the function "query()" in the Model
like so:
*snip*
function getNextSeqNr()
{
$seqnr = $this->query("SELECT (MAX(It
Hi,
thanks for your reply. You are right - i seem to work against the
framework due to my working habbits. I need to get used to cake first i
think.
Even so - do you know how to create your own query function. It looks
really confusing to me.
Cheers
Phil
On Nov 7, 1:33 pm, "lloydhome" <[EMAIL
Phil,
For most things it is better to have the data the way it is returned.
I would encourage you to work within the framework and not against it.
That said, maybe you have some logic that is legacy like I do. I am
porting a clumsy mess of code into Cake but it cannot be done all at
once. I hav
Hi all,
i was wondering why cake gives me a weird output array for my query
Query:
SELECT
jobName,
ujc.id,
roleName,
userName,
disciplineName
FROM user_job_con
63 matches
Mail list logo