Re: HOW TO DO THIS.

2011-02-12 Thread Jeremy Burns | Class Outfit
No-one will give out their Skype id as that opens the channels for being a help 
desk. Fine if you want to pay, but is bound to offend when you are declined.

This forum is a really, really good place to get help. Stick with it - you will 
get everything you need from here.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 12 Feb 2011, at 16:20, sanjib dhar wrote:

> Ok,thanks for your great advice.I will try to maintain all the jeremy's 
> step.If possible can u give me u'r skype id.I had opened a company with 
> kolkata,India clients.I want to work.But the problem is nobody help me out 
> locally because I am senior most.I often search in internet and get help.I 
> previously work in ror.If possible give me some advice.again thanks for u'r 
> great advice.
> 
> 
> On Sat, Feb 12, 2011 at 9:03 PM, euromark  wrote:
> when i go through the list of new messages in the group and i read
> "HOW TO DO THIS" or "PLEASE HELP"
> it just freaks me out
> 
> every other person on this group manages to summarize the problem in a
> short sentence
> this way you as a reader know right away what the problem is about
> you are not getting more help my SHOUTING (thats what capital letters
> are for, by the way)
> around cries of help...
> and THEN - only then - i will not feel offended and probably try to
> help you.
> 
> kinda ironic that just a few days ago a thread regarding this subject
> has been started:
> http://groups.google.com/group/cake-php/browse_thread/thread/c7bc0bb2a530ec08/c047cad1a7fcf0ec
> I like jeremy's etiquette guide :)
> 
> sincerely
> mark
> 
> 
> On 12 Feb., 07:22, sanjib dhar  wrote:
> > solved by view sln.
> >
> > On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com <
> >
> >
> >
> >
> >
> >
> >
> > sanjibdhar...@gmail.com> wrote:
> > > OK sorry.
> >
> > > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit
> > >  wrote:
> > > > Very respectful. Well done. I suspect he does know the answer.
> >
> > > > Jeremy Burns
> > > > Class Outfit
> >
> > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
> >
> > > > On 12 Feb 2011, at 04:24, sanjib dhar wrote:
> >
> > > > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > > > by the way
> > > > > this means u don't know the answer right.
> > > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark 
> > > wrote:
> > > > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > > > by the way
> >
> > > > > On 11 Feb., 18:27, sanjib dhar  wrote:
> > > > > > What will be the function like?Can you please send me.I am new in
> > > cakephp.
> >
> > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs 
> > > > > > 
> > > wrote:
> > > > > > > Well,
> >
> > > > > > > You can't sum price directly in your query since you are showing
> > > each
> > > > > > > record individually as well, so I guess you'll need a combination.
> >
> > > > > > > a) in your controller: find('all', array('order' =>
> > > 'Contractor.name,
> > > > > > > Table.dt'))
> > > > > > > b) in your view: sum up price while iterating. Whenever you get a
> > > new
> > > > > > > contractor: display sum and reset
> >
> > > > > > > Alternatively, you could create a function in your Contractor
> > > model,
> > > > > > > retrieving all contractors with contained items and have that
> > > function
> > > > > > > calculate the sum into the contractor results.
> >
> > > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" <
> > > sanjibdhar...@gmail.com>
> > > > > > > wrote:
> > > > > > > > I have a table
> > > > > > > > id
> > > > > > > > buyer_id
> > > > > > > > item_code
> > > > > > > > contractor_id
> > > > > > > > price
> > > > > > > > dt
> > > > > > > > item_name
> >
> > > > > > > > Now I want display dt(date) wise billing but contactor also will
> > > be in
> > > > > > > > sequence like this:
> >
> > > > > > > > Contractorbuyer_id  item_code  price
> > > > > > > > item_name
> > > > > > > > A   12   2112
> > > > > > > > Sjgj
> > > > > > > > A
> > > > > > > > 14..
> >
> > > ---
> > > ---
> > > > > > > > sum(price)
> >
> > > > > > > > B
> >
> > > ...
> > > ...
> > > > > > > > B
> >
> > >  
> > > ...
> > > ...
> > > > > > > > B
> >
> > > ...
> > > ...
> >
> > > ---
> > > ---
> > > > > > > > sum(price)
> > > > > > > > C
> >
> > > ...

Re: HOW TO DO THIS.

2011-02-12 Thread sanjib dhar
Ok,thanks for your great advice.I will try to maintain all the jeremy's
step.If possible can u give me u'r skype id.I had opened a company with
kolkata,India clients.I want to work.But the problem is nobody help me out
locally because I am senior most.I often search in internet and get help.I
previously work in ror.If possible give me some advice.again thanks for u'r
great advice.


On Sat, Feb 12, 2011 at 9:03 PM, euromark wrote:

> when i go through the list of new messages in the group and i read
> "HOW TO DO THIS" or "PLEASE HELP"
> it just freaks me out
>
> every other person on this group manages to summarize the problem in a
> short sentence
> this way you as a reader know right away what the problem is about
> you are not getting more help my SHOUTING (thats what capital letters
> are for, by the way)
> around cries of help...
> and THEN - only then - i will not feel offended and probably try to
> help you.
>
> kinda ironic that just a few days ago a thread regarding this subject
> has been started:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/c7bc0bb2a530ec08/c047cad1a7fcf0ec
> I like jeremy's etiquette guide :)
>
> sincerely
> mark
>
>
> On 12 Feb., 07:22, sanjib dhar  wrote:
> > solved by view sln.
> >
> > On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com <
> >
> >
> >
> >
> >
> >
> >
> > sanjibdhar...@gmail.com> wrote:
> > > OK sorry.
> >
> > > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit
> > >  wrote:
> > > > Very respectful. Well done. I suspect he does know the answer.
> >
> > > > Jeremy Burns
> > > > Class Outfit
> >
> > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
> >
> > > > On 12 Feb 2011, at 04:24, sanjib dhar wrote:
> >
> > > > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > > > by the way
> > > > > this means u don't know the answer right.
> > > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark <
> dereurom...@googlemail.com>
> > > wrote:
> > > > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > > > by the way
> >
> > > > > On 11 Feb., 18:27, sanjib dhar  wrote:
> > > > > > What will be the function like?Can you please send me.I am new in
> > > cakephp.
> >
> > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs <
> mattijsmeib...@hotmail.com>
> > > wrote:
> > > > > > > Well,
> >
> > > > > > > You can't sum price directly in your query since you are
> showing
> > > each
> > > > > > > record individually as well, so I guess you'll need a
> combination.
> >
> > > > > > > a) in your controller: find('all', array('order' =>
> > > 'Contractor.name,
> > > > > > > Table.dt'))
> > > > > > > b) in your view: sum up price while iterating. Whenever you get
> a
> > > new
> > > > > > > contractor: display sum and reset
> >
> > > > > > > Alternatively, you could create a function in your Contractor
> > > model,
> > > > > > > retrieving all contractors with contained items and have that
> > > function
> > > > > > > calculate the sum into the contractor results.
> >
> > > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" <
> > > sanjibdhar...@gmail.com>
> > > > > > > wrote:
> > > > > > > > I have a table
> > > > > > > > id
> > > > > > > > buyer_id
> > > > > > > > item_code
> > > > > > > > contractor_id
> > > > > > > > price
> > > > > > > > dt
> > > > > > > > item_name
> >
> > > > > > > > Now I want display dt(date) wise billing but contactor also
> will
> > > be in
> > > > > > > > sequence like this:
> >
> > > > > > > > Contractorbuyer_id  item_code  price
> > > > > > > > item_name
> > > > > > > > A   12   2112
> > > > > > > > Sjgj
> > > > > > > > A
> > > > > > > > 14..
> >
> > >
> ---
> > > ---
> > > > > > > > sum(price)
> >
> > > > > > > > B
> >
> > >
> ...
> > > ...
> > > > > > > > B
> >
> > >
>  ...
> > > ...
> > > > > > > > B
> >
> > >
> ...
> > > ...
> >
> > >
> ---
> > > ---
> > > > > > > > sum(price)
> > > > > > > > C
> >
> > >
> ...
> > > ...
> > > > > > > > C
> >
> > >
> ...
> > > ...
> > > > > > > > C
> >
> > >
> ...
> > > ...
> >
> > >
> --

Re: HOW TO DO THIS.

2011-02-12 Thread euromark
when i go through the list of new messages in the group and i read
"HOW TO DO THIS" or "PLEASE HELP"
it just freaks me out

every other person on this group manages to summarize the problem in a
short sentence
this way you as a reader know right away what the problem is about
you are not getting more help my SHOUTING (thats what capital letters
are for, by the way)
around cries of help...
and THEN - only then - i will not feel offended and probably try to
help you.

kinda ironic that just a few days ago a thread regarding this subject
has been started:
http://groups.google.com/group/cake-php/browse_thread/thread/c7bc0bb2a530ec08/c047cad1a7fcf0ec
I like jeremy's etiquette guide :)

sincerely
mark


On 12 Feb., 07:22, sanjib dhar  wrote:
> solved by view sln.
>
> On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com <
>
>
>
>
>
>
>
> sanjibdhar...@gmail.com> wrote:
> > OK sorry.
>
> > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit
> >  wrote:
> > > Very respectful. Well done. I suspect he does know the answer.
>
> > > Jeremy Burns
> > > Class Outfit
>
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > On 12 Feb 2011, at 04:24, sanjib dhar wrote:
>
> > > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > > by the way
> > > > this means u don't know the answer right.
> > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark 
> > wrote:
> > > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > > by the way
>
> > > > On 11 Feb., 18:27, sanjib dhar  wrote:
> > > > > What will be the function like?Can you please send me.I am new in
> > cakephp.
>
> > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs 
> > wrote:
> > > > > > Well,
>
> > > > > > You can't sum price directly in your query since you are showing
> > each
> > > > > > record individually as well, so I guess you'll need a combination.
>
> > > > > > a) in your controller: find('all', array('order' =>
> > 'Contractor.name,
> > > > > > Table.dt'))
> > > > > > b) in your view: sum up price while iterating. Whenever you get a
> > new
> > > > > > contractor: display sum and reset
>
> > > > > > Alternatively, you could create a function in your Contractor
> > model,
> > > > > > retrieving all contractors with contained items and have that
> > function
> > > > > > calculate the sum into the contractor results.
>
> > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" <
> > sanjibdhar...@gmail.com>
> > > > > > wrote:
> > > > > > > I have a table
> > > > > > >         id
> > > > > > >         buyer_id
> > > > > > >         item_code
> > > > > > >         contractor_id
> > > > > > >         price
> > > > > > >         dt
> > > > > > >         item_name
>
> > > > > > > Now I want display dt(date) wise billing but contactor also will
> > be in
> > > > > > > sequence like this:
>
> > > > > > > Contractor    buyer_id          item_code      price
> > > > > > > item_name
> > > > > > > A                       12                   2112
> > > > > > > S                jgj
> > > > > > > A
> > > > > > > 14            ..
>
> > ---
> > ---
> > > > > > >                                         sum(price)
>
> > > > > > > B
>
> > ...
> > ...
> > > > > > > B
>
> >  ...
> > ...
> > > > > > > B
>
> > ...
> > ...
>
> > ---
> > ---
> > > > > > >                                         sum(price)
> > > > > > > C
>
> > ...
> > ...
> > > > > > > C
>
> > ...
> > ...
> > > > > > > C
>
> > ...
> > ...
>
> > ---
> > ---
> > > > > > >                                         sum(price)
>
> > > > > > > how to write the query.
>
> > > > > > --
> > > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > > >http://tv.cakephp.org
> > > > > > Check out the new CakePHP Questions
> > sitehttp://ask.cakephp.organdhelp
> > > > > > others with their CakePHP related questions.
>
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > > > athttp://groups.google.com/group/cake-php
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorialshttp://
> > tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.

Re: HOW TO DO THIS.

2011-02-11 Thread sanjib dhar
solved by view sln.

On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com <
sanjibdhar...@gmail.com> wrote:

> OK sorry.
>
> On Feb 12, 9:58 am, Jeremy Burns | Class Outfit
>  wrote:
> > Very respectful. Well done. I suspect he does know the answer.
> >
> > Jeremy Burns
> > Class Outfit
> >
> > jeremybu...@classoutfit.comhttp://www.classoutfit.com
> >
> > On 12 Feb 2011, at 04:24, sanjib dhar wrote:
> >
> >
> >
> >
> >
> >
> >
> > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > by the way
> > > this means u don't know the answer right.
> > > On Sat, Feb 12, 2011 at 5:10 AM, euromark 
> wrote:
> > > "HOW TO DO THIS" is not an appropriate title for your thread!
> > > by the way
> >
> > > On 11 Feb., 18:27, sanjib dhar  wrote:
> > > > What will be the function like?Can you please send me.I am new in
> cakephp.
> >
> > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs 
> wrote:
> > > > > Well,
> >
> > > > > You can't sum price directly in your query since you are showing
> each
> > > > > record individually as well, so I guess you'll need a combination.
> >
> > > > > a) in your controller: find('all', array('order' =>
> 'Contractor.name,
> > > > > Table.dt'))
> > > > > b) in your view: sum up price while iterating. Whenever you get a
> new
> > > > > contractor: display sum and reset
> >
> > > > > Alternatively, you could create a function in your Contractor
> model,
> > > > > retrieving all contractors with contained items and have that
> function
> > > > > calculate the sum into the contractor results.
> >
> > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" <
> sanjibdhar...@gmail.com>
> > > > > wrote:
> > > > > > I have a table
> > > > > > id
> > > > > > buyer_id
> > > > > > item_code
> > > > > > contractor_id
> > > > > > price
> > > > > > dt
> > > > > > item_name
> >
> > > > > > Now I want display dt(date) wise billing but contactor also will
> be in
> > > > > > sequence like this:
> >
> > > > > > Contractorbuyer_id  item_code  price
> > > > > > item_name
> > > > > > A   12   2112
> > > > > > Sjgj
> > > > > > A
> > > > > > 14..
> >
> > > > >
> ---
> ---
> > > > > > sum(price)
> >
> > > > > > B
> > > > >
> ...
> ...
> > > > > > B
> > > > >
>  ...
> ...
> > > > > > B
> > > > >
> ...
> ...
> >
> > > > >
> ---
> ---
> > > > > > sum(price)
> > > > > > C
> > > > >
> ...
> ...
> > > > > > C
> > > > >
> ...
> ...
> > > > > > C
> > > > >
> ...
> ...
> >
> > > > >
> ---
> ---
> > > > > > sum(price)
> >
> > > > > > how to write the query.
> >
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
> >
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > > > athttp://groups.google.com/group/cake-php
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorialshttp://
> tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group athttp://groups.google.com/group/cake-php
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorialshttp://
> tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others

Re: HOW TO DO THIS.

2011-02-11 Thread sanjibdhar...@gmail.com
OK sorry.

On Feb 12, 9:58 am, Jeremy Burns | Class Outfit
 wrote:
> Very respectful. Well done. I suspect he does know the answer.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 12 Feb 2011, at 04:24, sanjib dhar wrote:
>
>
>
>
>
>
>
> > "HOW TO DO THIS" is not an appropriate title for your thread!
> > by the way
> > this means u don't know the answer right.
> > On Sat, Feb 12, 2011 at 5:10 AM, euromark  
> > wrote:
> > "HOW TO DO THIS" is not an appropriate title for your thread!
> > by the way
>
> > On 11 Feb., 18:27, sanjib dhar  wrote:
> > > What will be the function like?Can you please send me.I am new in cakephp.
>
> > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs  
> > > wrote:
> > > > Well,
>
> > > > You can't sum price directly in your query since you are showing each
> > > > record individually as well, so I guess you'll need a combination.
>
> > > > a) in your controller: find('all', array('order' => 'Contractor.name,
> > > > Table.dt'))
> > > > b) in your view: sum up price while iterating. Whenever you get a new
> > > > contractor: display sum and reset
>
> > > > Alternatively, you could create a function in your Contractor model,
> > > > retrieving all contractors with contained items and have that function
> > > > calculate the sum into the contractor results.
>
> > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" 
> > > > wrote:
> > > > > I have a table
> > > > >         id
> > > > >         buyer_id
> > > > >         item_code
> > > > >         contractor_id
> > > > >         price
> > > > >         dt
> > > > >         item_name
>
> > > > > Now I want display dt(date) wise billing but contactor also will be in
> > > > > sequence like this:
>
> > > > > Contractor    buyer_id          item_code      price
> > > > > item_name
> > > > > A                       12                   2112
> > > > > S                jgj
> > > > > A
> > > > > 14            ..
>
> > > > ---
> > > >  ---
> > > > >                                         sum(price)
>
> > > > > B
> > > > ...
> > > >  ...
> > > > > B
> > > >  ...
> > > >  ...
> > > > > B
> > > > ...
> > > >  ...
>
> > > > ---
> > > >  ---
> > > > >                                         sum(price)
> > > > > C
> > > > ...
> > > >  ...
> > > > > C
> > > > ...
> > > >  ...
> > > > > C
> > > > ...
> > > >  ...
>
> > > > ---
> > > >  ---
> > > > >                                         sum(price)
>
> > > > > how to write the query.
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HOW TO DO THIS.

2011-02-11 Thread Jeremy Burns | Class Outfit
Very respectful. Well done. I suspect he does know the answer.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 12 Feb 2011, at 04:24, sanjib dhar wrote:

> "HOW TO DO THIS" is not an appropriate title for your thread!
> by the way
> this means u don't know the answer right.
> On Sat, Feb 12, 2011 at 5:10 AM, euromark  wrote:
> "HOW TO DO THIS" is not an appropriate title for your thread!
> by the way
> 
> On 11 Feb., 18:27, sanjib dhar  wrote:
> > What will be the function like?Can you please send me.I am new in cakephp.
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs  wrote:
> > > Well,
> >
> > > You can't sum price directly in your query since you are showing each
> > > record individually as well, so I guess you'll need a combination.
> >
> > > a) in your controller: find('all', array('order' => 'Contractor.name,
> > > Table.dt'))
> > > b) in your view: sum up price while iterating. Whenever you get a new
> > > contractor: display sum and reset
> >
> > > Alternatively, you could create a function in your Contractor model,
> > > retrieving all contractors with contained items and have that function
> > > calculate the sum into the contractor results.
> >
> > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" 
> > > wrote:
> > > > I have a table
> > > > id
> > > > buyer_id
> > > > item_code
> > > > contractor_id
> > > > price
> > > > dt
> > > > item_name
> >
> > > > Now I want display dt(date) wise billing but contactor also will be in
> > > > sequence like this:
> >
> > > > Contractorbuyer_id  item_code  price
> > > > item_name
> > > > A   12   2112
> > > > Sjgj
> > > > A
> > > > 14..
> >
> > > ---
> > >  ---
> > > > sum(price)
> >
> > > > B
> > > ...
> > >  ...
> > > > B
> > >  
> > > ...
> > >  ...
> > > > B
> > > ...
> > >  ...
> >
> > > ---
> > >  ---
> > > > sum(price)
> > > > C
> > > ...
> > >  ...
> > > > C
> > > ...
> > >  ...
> > > > C
> > > ...
> > >  ...
> >
> > > ---
> > >  ---
> > > > sum(price)
> >
> > > > how to write the query.
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php
> 
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


RE: HOW TO DO THIS.

2011-02-11 Thread Krissy Masters
Seriously?

Euromark is a name I look for in responses because he knows what he is
talking about! 
But after that comment I doubt you will see many responses to any of your
questions. From SanJib => delete message.

Also if you knew how to ask a question then maybe someone could answer it.

K

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HOW TO DO THIS.

2011-02-11 Thread sanjib dhar
*"HOW TO DO THIS" is not an appropriate title for your thread!
by the way
*this means u don't know the answer right.
On Sat, Feb 12, 2011 at 5:10 AM, euromark wrote:

> "HOW TO DO THIS" is not an appropriate title for your thread!
> by the way
>
> On 11 Feb., 18:27, sanjib dhar  wrote:
> > What will be the function like?Can you please send me.I am new in
> cakephp.
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs 
> wrote:
> > > Well,
> >
> > > You can't sum price directly in your query since you are showing each
> > > record individually as well, so I guess you'll need a combination.
> >
> > > a) in your controller: find('all', array('order' => 'Contractor.name,
> > > Table.dt'))
> > > b) in your view: sum up price while iterating. Whenever you get a new
> > > contractor: display sum and reset
> >
> > > Alternatively, you could create a function in your Contractor model,
> > > retrieving all contractors with contained items and have that function
> > > calculate the sum into the contractor results.
> >
> > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" 
> > > wrote:
> > > > I have a table
> > > > id
> > > > buyer_id
> > > > item_code
> > > > contractor_id
> > > > price
> > > > dt
> > > > item_name
> >
> > > > Now I want display dt(date) wise billing but contactor also will be
> in
> > > > sequence like this:
> >
> > > > Contractorbuyer_id  item_code  price
> > > > item_name
> > > > A   12   2112
> > > > Sjgj
> > > > A
> > > > 14..
> >
> > >
> ---
> ---
> > > > sum(price)
> >
> > > > B
> > >
> ...
> ...
> > > > B
> > >
>  ...
> ...
> > > > B
> > >
> ...
> ...
> >
> > >
> ---
> ---
> > > > sum(price)
> > > > C
> > >
> ...
> ...
> > > > C
> > >
> ...
> ...
> > > > C
> > >
> ...
> ...
> >
> > >
> ---
> ---
> > > > sum(price)
> >
> > > > how to write the query.
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HOW TO DO THIS.

2011-02-11 Thread euromark
"HOW TO DO THIS" is not an appropriate title for your thread!
by the way

On 11 Feb., 18:27, sanjib dhar  wrote:
> What will be the function like?Can you please send me.I am new in cakephp.
>
>
>
>
>
>
>
> On Fri, Feb 11, 2011 at 6:55 PM, Mattijs  wrote:
> > Well,
>
> > You can't sum price directly in your query since you are showing each
> > record individually as well, so I guess you'll need a combination.
>
> > a) in your controller: find('all', array('order' => 'Contractor.name,
> > Table.dt'))
> > b) in your view: sum up price while iterating. Whenever you get a new
> > contractor: display sum and reset
>
> > Alternatively, you could create a function in your Contractor model,
> > retrieving all contractors with contained items and have that function
> > calculate the sum into the contractor results.
>
> > On 11 feb, 13:56, "sanjibdhar...@gmail.com" 
> > wrote:
> > > I have a table
> > >         id
> > >         buyer_id
> > >         item_code
> > >         contractor_id
> > >         price
> > >         dt
> > >         item_name
>
> > > Now I want display dt(date) wise billing but contactor also will be in
> > > sequence like this:
>
> > > Contractor    buyer_id          item_code      price
> > > item_name
> > > A                       12                   2112
> > > S                jgj
> > > A
> > > 14            ..
>
> > --- 
> > ---
> > >                                         sum(price)
>
> > > B
> > ... 
> > ...
> > > B
> >  ...
> >  ...
> > > B
> > ... 
> > ...
>
> > --- 
> > ---
> > >                                         sum(price)
> > > C
> > ... 
> > ...
> > > C
> > ... 
> > ...
> > > C
> > ... 
> > ...
>
> > --- 
> > ---
> > >                                         sum(price)
>
> > > how to write the query.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HOW TO DO THIS.

2011-02-11 Thread sanjib dhar
What will be the function like?Can you please send me.I am new in cakephp.

On Fri, Feb 11, 2011 at 6:55 PM, Mattijs  wrote:

> Well,
>
> You can't sum price directly in your query since you are showing each
> record individually as well, so I guess you'll need a combination.
>
> a) in your controller: find('all', array('order' => 'Contractor.name,
> Table.dt'))
> b) in your view: sum up price while iterating. Whenever you get a new
> contractor: display sum and reset
>
> Alternatively, you could create a function in your Contractor model,
> retrieving all contractors with contained items and have that function
> calculate the sum into the contractor results.
>
> On 11 feb, 13:56, "sanjibdhar...@gmail.com" 
> wrote:
> > I have a table
> > id
> > buyer_id
> > item_code
> > contractor_id
> > price
> > dt
> > item_name
> >
> > Now I want display dt(date) wise billing but contactor also will be in
> > sequence like this:
> >
> > Contractorbuyer_id  item_code  price
> > item_name
> > A   12   2112
> > Sjgj
> > A
> > 14..
> >
> --
> > sum(price)
> >
> > B
> ..
> > B
>  
> ..
> > B
> ..
> >
> --
> > sum(price)
> > C
> ..
> > C
> ..
> > C
> ..
> >
> --
> > sum(price)
> >
> > how to write the query.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HOW TO DO THIS.

2011-02-11 Thread Mattijs
Well,

You can't sum price directly in your query since you are showing each
record individually as well, so I guess you'll need a combination.

a) in your controller: find('all', array('order' => 'Contractor.name,
Table.dt'))
b) in your view: sum up price while iterating. Whenever you get a new
contractor: display sum and reset

Alternatively, you could create a function in your Contractor model,
retrieving all contractors with contained items and have that function
calculate the sum into the contractor results.

On 11 feb, 13:56, "sanjibdhar...@gmail.com" 
wrote:
> I have a table
>         id
>         buyer_id
>         item_code
>         contractor_id
>         price
>         dt
>         item_name
>
> Now I want display dt(date) wise billing but contactor also will be in
> sequence like this:
>
> Contractor    buyer_id          item_code      price
> item_name
> A                       12                   2112
> S                jgj
> A
> 14            ..
> --
>                                         sum(price)
>
> B     
> ..
> B      
> ..
> B     
> ..
> --
>                                         sum(price)
> C   
> ..
> C   
> ..
> C   
> ..
> --
>                                         sum(price)
>
> how to write the query.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to do this in cakephp

2009-01-09 Thread mona

this will help me but it is not returning value it is returning only
Array as value please help me how to solve this porblem
---see this --
Counter : Array

function index(){
$count = $this->Entry->find('all', array('fields' => array('(max
(Entry.counter)) as max_counter')));


$this->set('count',$count);
$name=$this->Session->read('User');
$query1=mysql_query("select id from users where username='$name'");
$row1=mysql_fetch_array($query1);
$user_id=$row1[0];
$this->set('user_id',$user_id);
$this->Entry->recursive = 1;
$this->set('entries', $this->Entry->findAll(null, null, array
('Section.id' => 'ASC','Submenu.submenu' => 'ASC')));
}

It is returning value as counter
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to do this in cakephp

2009-01-08 Thread Webweave

$count = $this->Entry->find('all', array('fields' => array('(max
(Entries.counter)) as max_counter'));

Will return an array with the max_counter value in it.

On Jan 8, 8:29 am, mona  wrote:
> I know how to handle queries but i don't know how to fetch values of
> variables for example
> i wan't to fetch max(counter) so i know how to write query but how to
> store value of this in some variable and print them in my index view
> for eg
>     $query=mysql_query("select max(counter) from entries");
> how to fetch max value from database of some field in cakephp how to
> write this query in cakephp
> $row=mysql_fetch_array($query);
>         $co=$row[0]+1; '
> what to use instead of mysql_fetch_array in cakephp
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to do this in cakephp

2009-01-08 Thread mona


I know how to handle queries but i don't know how to fetch values of
variables for example
i wan't to fetch max(counter) so i know how to write query but how to
store value of this in some variable and print them in my index view
for eg
$query=mysql_query("select max(counter) from entries");
how to fetch max value from database of some field in cakephp how to
write this query in cakephp
$row=mysql_fetch_array($query);
$co=$row[0]+1; '
what to use instead of mysql_fetch_array in cakephp
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to do this in cakephp

2009-01-08 Thread Webweave

I'm not sure I understand your question, but if you have a field you
want to save a counter in, you can do this in the model using
countCache: http://book.cakephp.org/view/445/cacheQueries

If on the other hand you need to find the count from some set of
values, you can simply use find('count'): 
http://book.cakephp.org/view/73/Retrieving-Your-Data

On Jan 8, 4:46 am, mona  wrote:
> I have code of my controller in which i use normal php codes to fetch
> data from a database and update counter how to do this in cakephp
>
>  class EntriesController extends AppController
>  {
>         var $name = 'Entries';
>     var $helpers = array('Html','Form','Javascript','Ajax');
>     var $components = array('RequestHandler');
>         //var $uses=array('Entry','User');
>         function index(){
>
> -please consider it
> -
>     $query=mysql_query("select max(counter) from entries");
>     $row=mysql_fetch_array($query);
>         $co=$row[0];
>         $this->set('co',$co);
>         $name=$this->Session->read('User');
>         $query1=mysql_query("select id from users where username='$name'");
>     $row1=mysql_fetch_array($query1);
>         $user_id=$row1[0];
>         $this->set('user_id',$user_id);
> 
>
>         $this->Entry->recursive = 1;
>         $this->set('entries', $this->Entry->findAll(null, null, array
> ('Section.id' => 'ASC','Submenu.submenu' => 'ASC')));
>     }
>
>          function view($id = null){
>          if (!$id){
>          $this->Session->setFlash('Invalid id for Entry.');
>          $this->redirect('/entries/index');
>          }
>          $this->set('entry', $this->Entry->read(null, $id));
>          }
>
>     function add(){
>     $this->set('sections', $this->Entry->Section->find('list',array
> ('fields'=>'Section.section','Section.id')));
>         if (empty($this->data)){
>         $this->render();
>         }
>     else{
>         $this->data['Entry']['name'] = $this->data['Entry']['File']['name'];
>     $this->data['Entry']['type'] = $this->data['Entry']['File']
> ['type'];
>     $this->data['Entry']['size'] = $this->data['Entry']['File']
> ['size'];
>         if ($this->Entry->save($this->data)){
> -please check it from
> here---
>         $id=mysql_insert_id();
>         $query=mysql_query("select max(counter) from entries");
>     $row=mysql_fetch_array($query);
>     $co=$row[0]+1;
>     $q=mysql_query("update entries set counter=$co where id=$id");
> --
>         $this->Session->setFlash('The Entry has been saved');
>         }
>     else{
>         $this->Session->setFlash('Please correct errors below.');
>         $this->redirect('/entries/add');
>         }
>     if (move_uploaded_file($this->data['Entry']['File']['tmp_name'],
> WWW_ROOT.'/files/' .$this->data['Entry']['File']['name']))
>     {
>         echo "File uploaded successfully";
>     }
>     else{
>     echo "There was an error uploading the file, please try again!";
>         }
>     $this->redirect('/entries/index');
>     }
>     }
>
>         function edit($id = null){
>         $this->set('sections', $this->Entry->Section->find('list',array
> ('fields'=>'Section.section','Section.id','recursive' => 1,'page' =>
> 1,)));
>         if (empty($this->data)){
>         if (!$id){
>         $this->Session->setFlash('Invalid id for Entry');
>         $this->redirect('/entries/index');
>         }
>         $this->data = $this->Entry->read(null, $id);
>         }
>         else{
> ---please
> check--
>     $query=mysql_query("select max(counter) from entries");
>     $row=mysql_fetch_array($query);
>         $co=$row[0]+1;
>     $q=mysql_query("update entries set counter=$co where id=$id");
> 
>         if ($this->Entry->save($this->data)){
>         $this->Session->setFlash('The Entry has been saved');
>         $this->redirect('/entries/index');
>         }
>         else{
>         $this->Session->setFlash('Please correct errors below.');
>         }
>         }
>         }
>
>     function delete($id = null){
>         if (!$id){
>         $this->Session->setFlash('Invalid id for Entry');
>         $this->redirect('/entries/index');
>         }
>         if ($this->Entry->del($id)){
>         $this->Session->setFlash('Record deleted successfully');
>         $this->redirect('/entries/index');
>         }
>         }
>
>     function update_select(){
>     if(!empty($this->data['

Re: How to do this in cakephp

2009-01-08 Thread Bernardo Vieira

You can use Model->query('any sql statement') to execute arbitrary sql 
code. Bear in mind, however, that what you're trying to do can be done 
with cake's built in methods in a much cleaner way. Model->query()  
should really be used as a last resort when cake can't handle what 
you're trying to do natively. Please do take some time to read the docs 
(http://book.cakephp.org/) you'll find answers to 90% of your problemas 
in the first 4 chapters.


mona wrote:
> I have code of my controller in which i use normal php codes to fetch
> data from a database and update counter how to do this in cakephp
>
>
>  class EntriesController extends AppController
>  {
>   var $name = 'Entries';
> var $helpers = array('Html','Form','Javascript','Ajax');
> var $components = array('RequestHandler');
>   //var $uses=array('Entry','User');
>   function index(){
>
> -please consider it
> -
> $query=mysql_query("select max(counter) from entries");
> $row=mysql_fetch_array($query);
>   $co=$row[0];
>   $this->set('co',$co);
>   $name=$this->Session->read('User');
>   $query1=mysql_query("select id from users where username='$name'");
> $row1=mysql_fetch_array($query1);
>   $user_id=$row1[0];
>   $this->set('user_id',$user_id);
> 
>
>
>   $this->Entry->recursive = 1;
>   $this->set('entries', $this->Entry->findAll(null, null, array
> ('Section.id' => 'ASC','Submenu.submenu' => 'ASC')));
> }
>
>function view($id = null){
>if (!$id){
>$this->Session->setFlash('Invalid id for Entry.');
>$this->redirect('/entries/index');
>}
>$this->set('entry', $this->Entry->read(null, $id));
>}
>
> function add(){
> $this->set('sections', $this->Entry->Section->find('list',array
> ('fields'=>'Section.section','Section.id')));
>   if (empty($this->data)){
>   $this->render();
>   }
> else{
>   $this->data['Entry']['name'] = $this->data['Entry']['File']['name'];
> $this->data['Entry']['type'] = $this->data['Entry']['File']
> ['type'];
> $this->data['Entry']['size'] = $this->data['Entry']['File']
> ['size'];
>   if ($this->Entry->save($this->data)){
> -please check it from
> here---
>   $id=mysql_insert_id();
>   $query=mysql_query("select max(counter) from entries");
> $row=mysql_fetch_array($query);
> $co=$row[0]+1;
> $q=mysql_query("update entries set counter=$co where id=$id");
> --
>   $this->Session->setFlash('The Entry has been saved');
>   }
> else{
>   $this->Session->setFlash('Please correct errors below.');
>   $this->redirect('/entries/add');
>   }
> if (move_uploaded_file($this->data['Entry']['File']['tmp_name'],
> WWW_ROOT.'/files/' .$this->data['Entry']['File']['name']))
> {
>   echo "File uploaded successfully";
> }
> else{
> echo "There was an error uploading the file, please try again!";
>   }
> $this->redirect('/entries/index');
> }
> }
>
>   function edit($id = null){
>   $this->set('sections', $this->Entry->Section->find('list',array
> ('fields'=>'Section.section','Section.id','recursive' => 1,'page' =>
> 1,)));
>   if (empty($this->data)){
>   if (!$id){
>   $this->Session->setFlash('Invalid id for Entry');
>   $this->redirect('/entries/index');
>   }
>   $this->data = $this->Entry->read(null, $id);
>   }
>   else{
> ---please
> check--
> $query=mysql_query("select max(counter) from entries");
> $row=mysql_fetch_array($query);
>   $co=$row[0]+1;
> $q=mysql_query("update entries set counter=$co where id=$id");
> 
>   if ($this->Entry->save($this->data)){
>   $this->Session->setFlash('The Entry has been saved');
>   $this->redirect('/entries/index');
>   }
>   else{
>   $this->Session->setFlash('Please correct errors below.');
>   }
>   }
>   }
>
> function delete($id = null){
>   if (!$id){
>   $this->Session->setFlash('Invalid id for Entry');
>   $this->redirect('/entries/index');
>   }
>   if ($this->Entry->del($id)){
>   $this->Session->setFlash('Record deleted successfully');
>   $this->redirect('/entries/index');
>   }
>   }
>
> function update_select(){
> if(!empty($this->data['Entry']['section_id'])){
> $sect

Re: How to do this in cakephp

2009-01-08 Thread 703designs

How to do what in CakePHP?

Thomas

On Jan 8, 7:46 am, mona  wrote:
> I have code of my controller in which i use normal php codes to fetch
> data from a database and update counter how to do this in cakephp
>
>  class EntriesController extends AppController
>  {
>         var $name = 'Entries';
>     var $helpers = array('Html','Form','Javascript','Ajax');
>     var $components = array('RequestHandler');
>         //var $uses=array('Entry','User');
>         function index(){
>
> -please consider it
> -
>     $query=mysql_query("select max(counter) from entries");
>     $row=mysql_fetch_array($query);
>         $co=$row[0];
>         $this->set('co',$co);
>         $name=$this->Session->read('User');
>         $query1=mysql_query("select id from users where username='$name'");
>     $row1=mysql_fetch_array($query1);
>         $user_id=$row1[0];
>         $this->set('user_id',$user_id);
> 
>
>         $this->Entry->recursive = 1;
>         $this->set('entries', $this->Entry->findAll(null, null, array
> ('Section.id' => 'ASC','Submenu.submenu' => 'ASC')));
>     }
>
>          function view($id = null){
>          if (!$id){
>          $this->Session->setFlash('Invalid id for Entry.');
>          $this->redirect('/entries/index');
>          }
>          $this->set('entry', $this->Entry->read(null, $id));
>          }
>
>     function add(){
>     $this->set('sections', $this->Entry->Section->find('list',array
> ('fields'=>'Section.section','Section.id')));
>         if (empty($this->data)){
>         $this->render();
>         }
>     else{
>         $this->data['Entry']['name'] = $this->data['Entry']['File']['name'];
>     $this->data['Entry']['type'] = $this->data['Entry']['File']
> ['type'];
>     $this->data['Entry']['size'] = $this->data['Entry']['File']
> ['size'];
>         if ($this->Entry->save($this->data)){
> -please check it from
> here---
>         $id=mysql_insert_id();
>         $query=mysql_query("select max(counter) from entries");
>     $row=mysql_fetch_array($query);
>     $co=$row[0]+1;
>     $q=mysql_query("update entries set counter=$co where id=$id");
> --
>         $this->Session->setFlash('The Entry has been saved');
>         }
>     else{
>         $this->Session->setFlash('Please correct errors below.');
>         $this->redirect('/entries/add');
>         }
>     if (move_uploaded_file($this->data['Entry']['File']['tmp_name'],
> WWW_ROOT.'/files/' .$this->data['Entry']['File']['name']))
>     {
>         echo "File uploaded successfully";
>     }
>     else{
>     echo "There was an error uploading the file, please try again!";
>         }
>     $this->redirect('/entries/index');
>     }
>     }
>
>         function edit($id = null){
>         $this->set('sections', $this->Entry->Section->find('list',array
> ('fields'=>'Section.section','Section.id','recursive' => 1,'page' =>
> 1,)));
>         if (empty($this->data)){
>         if (!$id){
>         $this->Session->setFlash('Invalid id for Entry');
>         $this->redirect('/entries/index');
>         }
>         $this->data = $this->Entry->read(null, $id);
>         }
>         else{
> ---please
> check--
>     $query=mysql_query("select max(counter) from entries");
>     $row=mysql_fetch_array($query);
>         $co=$row[0]+1;
>     $q=mysql_query("update entries set counter=$co where id=$id");
> 
>         if ($this->Entry->save($this->data)){
>         $this->Session->setFlash('The Entry has been saved');
>         $this->redirect('/entries/index');
>         }
>         else{
>         $this->Session->setFlash('Please correct errors below.');
>         }
>         }
>         }
>
>     function delete($id = null){
>         if (!$id){
>         $this->Session->setFlash('Invalid id for Entry');
>         $this->redirect('/entries/index');
>         }
>         if ($this->Entry->del($id)){
>         $this->Session->setFlash('Record deleted successfully');
>         $this->redirect('/entries/index');
>         }
>         }
>
>     function update_select(){
>     if(!empty($this->data['Entry']['section_id'])){
>     $section_id = (int)$this->data['Entry']['section_id'];
>     $options = $this->Entry->Submenu->find('list',array('section_id'=>
> $section_id,'recursive' => 1,'conditions'=>array('section_id'=>
> $section_id),'page' => 1,'fields'=>'Submenu.submenu'));
>     $this->set('options',$optio

Re: How to do this SQL query in Cake way - use one column twice in the same query.

2008-12-22 Thread Webweave

>From your original SQL, it looks like you want to AND two LIKE
statements (which is guaranteed to be very slow), but that said, why
not just do that in your conditions:

$whereArray = array('conditions' => array(
'AND' => array(
'referer like %google%',
'referer like %\%E6\%B5\%81\%E7\%A8\%8B
\%E5\%9B\%BE%',
'request_path like /blog/posts/view/
flowchart-howtos%'
)
)

On Dec 22, 12:01 am, "felixd...@gmail.com" 
wrote:
> Hi all, I have such a SQL statement to query:
> SELECT * FROM `mytable` WHERE `referer` LIKE '%google%' AND `referer`
> LIKE '%\%E6\%B5\%81\%E7\%A8\%8B\%E5\%9B\%BE%' AND `request_path` LIKE
> '/blog/posts/view/flowchart-howtos%'
>
> I use the column `referer` twice in the same SQL query.
>
> I tried with
>
> $this->LogParser->find(array('referer LIKE'=>array('%google%', '%\%E6\
> %B5\%81\%E7\%A8\%8B\%E5\%9B\%BE%'), 'request_path LIKE'=>'/blog/posts/
> view/flowchart-howtos%'));
>
> which gave me
>
> ... WHERE `referer LIKE` IN ('%google%', '%E6%B5%81%E7%A8%8B%E5%9B
> %BE') ...
>
> apparently that is not correct.
>
> Any can kindly help me? Thanks!
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---