Hi,
I am not able to reproduce this issue any way. Which version of Cake are
you using?
However you can check id is null before calling findById function.
On Thu, Jul 11, 2013 at 2:40 PM, Abhay Jeet Singh wrote:
> Hi,
>
>I am fetching the data in foreach loop by id as atta
Hi,
I am fetching the data in foreach loop by id as attached file
(secure_find.png). that return the garbage data for id null, although we
have no record with id null.
i have imported a model to another model then fetching the data. Plz
suggest.
Thanks in advance!
--
Like Us on Face
try this
http://arafats.info/cakephp-findbyfieldname-data-read/
On Wed, Aug 29, 2012 at 4:08 PM, Nareh Tarasyan wrote
:
> Hey, ppl. help me.
> I try this code:
>
> IndexsController.php
> $this->set('x', $this->Word->findByid(10));
>
> then
> view/
areh Tarasyan wrote:
>>
>> Hey, ppl. help me.
>> I try this code:
>>
>> IndexsController.php
>> $this->set('x', $this->Word->findByid(10));
>>
>> then
>> view/Indexs/index.ctp
>> echo "word= ".$x;
>>
>&
wrote:
> It would return an array. so use print_r($x); not echo.
>
> On Wednesday, August 29, 2012 3:38:04 PM UTC+5:30, Nareh Tarasyan wrote:
> Hey, ppl. help me.
> I try this code:
>
> IndexsController.php
> $this->set('x', $this->Word->findByid(
It would return an array. so use print_r($x); not echo.
On Wednesday, August 29, 2012 3:38:04 PM UTC+5:30, Nareh Tarasyan wrote:
>
> Hey, ppl. help me.
> I try this code:
>
> IndexsController.php
> $this->set('x', $this->Word->findByid(10));
>
> then
Try debug($x);
T
On Wed, Aug 29, 2012 at 3:38 PM, Nareh Tarasyan wrote:
> Hey, ppl. help me.
> I try this code:
>
> IndexsController.php
> $this->set('x', $this->Word->findByid(10));
>
--
===
I think it should be
$this->set('x', $this->Word->findById(10)); not $this->set('x',
$this->Word->findByid(10));
Shiv
On Wed, Aug 29, 2012 at 3:44 PM, AD7six wrote:
> Have a look at what $x is.
>
> On Wednesday, 29 August 2012 12:08:04 UTC+2
Have a look at what $x is.
On Wednesday, 29 August 2012 12:08:04 UTC+2, Nareh Tarasyan wrote:
>
> Hey, ppl. help me.
> I try this code:
>
> IndexsController.php
> $this->set('x', $this->Word->findByid(10));
>
> then
> view/Indexs/index.ctp
>
Hey, ppl. help me.
I try this code:
IndexsController.php
$this->set('x', $this->Word->findByid(10));
then
view/Indexs/index.ctp
echo "word= ".$x;
It echoes
word=Array;
What is the problem??? When I have loaded Word model in my
IndexsController, and I have a
Thanks for the instruction, it now works.
On 26 tra, 23:22, cricket wrote:
> On Tue, Apr 26, 2011 at 4:35 PM, Salines wrote:
> > Sorry my English is not good.
>
> > when I call exp,www.example.com/brands/view/2
>
> > Show some information about the brand and the last 9 related products
> > added
On Tue, Apr 26, 2011 at 4:35 PM, Salines wrote:
> Sorry my English is not good.
>
> when I call exp, www.example.com/brands/view/2
>
> Show some information about the brand and the last 9 related products
> added to the database, which are active 1 (online status).
>
> The brand has many products,
> > $this->Session->setFlash(__('Invalid brand', true));
> > $this->redirect(array('action' => 'index'));
> > }
> > // Need here some conditions, please help..
> >
array('action' => 'index'));
>}
>// Need here some conditions, please help..
>$brand = $this->Brand->findById($id);
>$this->set('brand',$brand );
> }
>
> }
>
&
rect(array('action' => 'index'));
}
// Need here some conditions, please help..
$brand = $this->Brand->findById($id);
$this->set('brand',$brand );
}
}
--
Our newest site for the commu
Y `created` DESC LIMIT 9
How can do with read() or findById() ???
--
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 g
>
> > > i just wanted to change a controller of mine and added a new column to
> > > a table in the database.
> > > As far as i thought "findById()" gets the whole row out of the table
> > > but that isn't happening.
> > > Do i have t
he /tmp/cache/models
>
>
> Andras Kende
> http://www.kende.com
>
> On Aug 17, 2010, at 6:32 AM, func0der wrote:
>
> > Hey guys,
> >
> > i just wanted to change a controller of mine and added a new column to
> > a table in the database.
> > As far as i
Try to clear the cache /tmp/cache/models
Andras Kende
http://www.kende.com
On Aug 17, 2010, at 6:32 AM, func0der wrote:
> Hey guys,
>
> i just wanted to change a controller of mine and added a new column to
> a table in the database.
> As far as i thought "findById()&quo
Hey guys,
i just wanted to change a controller of mine and added a new column to
a table in the database.
As far as i thought "findById()" gets the whole row out of the table
but that isn't happening.
Do i have to change anything in my controller, clear the cache or
anything e
hey thanks for your reply. but i found the error. it was another one.
i forgot
echo $form->input('id', array('type'=>'hidden'));
in my view. so everytime a new page was generated!
i do always use
$this->show($id);
$this->render("show");
after edit and it works fine! i am using cake for 3 years n
everything is fine i get an array with
> $data['Page'] and $data['Document'];
>
> function show($id)
> {
> $data = $this->Page->findById($id);
> $this->set("data", $data);
> }
>
> wh
;
function show($id)
{
$data = $this->Page->findById($id);
$this->set("data", $data);
}
when i call edit function everything works fine too. but after i call
$this->Page->save($this->data) i want to go back to show function.
$this->Sessi
I guess its just habit or personal preference. I tend to use read,
just to make sure that joins are never returned (though i also tend to
set recursive=-1 in my app_model so that problem never actually
happens). I use find for more complex queries.
On Feb 26, 11:16 am, WebbedIT wrote:
> I always
I always use find, not for any particular reason other than I am then
using a consistent command across my site with a consistent way to
pass in my variables to control the results I get.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questio
; in the view of the performance.
> > > The first way i use was this.
>
> > > $entry = $this->WishlistEntry->read(null, $this->data['WishlistEntry']
> > > ['wishlist_entry_id']);
> > > in the next step of my programming evolution
; in the view of the performance.
> > > The first way i use was this.
>
> > > $entry = $this->WishlistEntry->read(null, $this->data['WishlistEntry']
> > > ['wishlist_entry_id']);
> > > in the next step of my programming evolution
try']
> > ['wishlist_entry_id']);
> > in the next step of my programming evolution i found findById.
>
> > $entry = $this->MyModel->findById($this->data['MyModel']
> > ['entry_id']);
>
> > What are the difference betwee
WishlistEntry->read(null, $this->data['WishlistEntry']
> ['wishlist_entry_id']);
> in the next step of my programming evolution i found findById.
>
> $entry = $this->MyModel->findById($this->data['MyModel']
> ['entry_id']);
>
as this.
>
> $entry = $this->WishlistEntry->read(null, $this->data['WishlistEntry']
> ['wishlist_entry_id']);
> in the next step of my programming evolution i found findById.
>
> $entry = $this->MyModel->findById($this->data['MyModel']
programming evolution i found findById.
$entry = $this->MyModel->findById($this->data['MyModel']
['entry_id']);
What are the difference between this tow lines of code. Which is
better for the performance
many greetings
marcus radisch
Check out the new CakePHP Questions
It works!
Thanks very much.
On Jul 17, 1:45 am, mark_story <[EMAIL PROTECTED]> wrote:
> Try setting $this->Order->recursive = 2 before doing the find. Since
> order doesn't directly relate to Shop it doesn't come up in the find
> results with default settings.
>
> -Mark
>
> On Jul 16, 5:42 am, i
I've posted this yesterday, but I can't find it, so I post it again.
---
Hi,
I have 4 tables.
people
id
name
foods
id
name
shopid
shops
id
name
orders
id
peopleid
foodid
In
Try setting $this->Order->recursive = 2 before doing the find. Since
order doesn't directly relate to Shop it doesn't come up in the find
results with default settings.
-Mark
On Jul 16, 5:42 am, iWorm <[EMAIL PROTECTED]> wrote:
--~--~-~--~~~---~--~~
You received
Hi,
I have 4 tables.
people
id
name
foods
id
name
shopid
shops
id
name
orders
id
peopleid
foodid
In my application, 1 order has 1 food, 1 shop has many foods, 1 people
has many orders
Models:
//People
var $hasMany = array(
'Order' => array(
On Sep 15, 10:12 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> You can't use $this-> inside another model.
At the risk of starting a pie fight, the above isn't true.
If your associations are setup such that from a controller you are
able to do:
$this->
Hi Charlie,
What Tarique is talking about is low/loose/weak coupling. Coupling is the
degree of dependency between modules.
Low coupling refers to a relationship in which one module interacts with
another module through a stable interface and does not need to be concerned
with the other module's
Thnx Tarique,
I get your point. I agree but for now it has to be like this.
Thnx anyway
On Sep 16, 10:43 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 9/16/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote:
>
>
>
> > You got my attention. Why is this? Is this because of performance
On 9/16/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote:
>
> You got my attention. Why is this? Is this because of performance
> issues? What do you mean by 'loose coupling'?
>
http://en.wikipedia.org/wiki/Loose_coupling
Loosely coupled models are desirable amongst other things because they
>
> > On 9/15/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote:
> > > // In model Ticker:
> > > $artists = $this->Artist->findById(12);
>
> > > is not working because the model Artist is not known (?) in model
> > > Ticker. Even with the
On 9/16/07, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> On 9/15/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote:
> > // In model Ticker:
> > $artists = $this->Artist->findById(12);
> >
> > is not working because the model Artist is not known
On 9/15/07, Charlie van de Kerkhof <[EMAIL PROTECTED]> wrote:
> // In model Ticker:
> $artists = $this->Artist->findById(12);
>
> is not working because the model Artist is not known (?) in model
> Ticker. Even with the loadModel('Artist') is is not working.
&
el Ticker:
> > $artists = $this->Artist->findById(12);
>
> > is not working because the model Artist is not known (?) in model
> > Ticker. Even with the loadModel('Artist') is is not working.
>
> > Anyone any idea?
> > thnx in advance
>
> You can
ot;Marcelo Linhares" <[EMAIL PROTECTED]>
wrote:
> $uses = array("Artist","Ticker");
>
> []s
> Marcelo Linhares
>
> 2007/9/15, Charlie van de Kerkhof <[EMAIL PROTECTED]>:
>
>
>
>
>
> > Hi,
>
> > I like to use the mode
$uses = array("Artist","Ticker");
[]s
Marcelo Linhares
2007/9/15, Charlie van de Kerkhof <[EMAIL PROTECTED]>:
>
> Hi,
>
> I like to use the model standard functions like findById() in another
> model instead of a controller.
> In model Ticker I want
Hi,
I like to use the model standard functions like findById() in another
model instead of a controller.
In model Ticker I want data from a table called 'artists' which has
model 'Artist' but model Ticker doesn't use a database table.
// In model Ticker:
$artists = $
t;field();
~GreyCells
On Apr 7, 8:33 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> when code in cake,I always encounter the situation $this->User-
>
> >findById('3')['User']['name'] ,something like that.
>
> but it doe
efined!
(req:
'".implode('.',$member)."')",E_USER_NOTICE);
break;
}
}
return $data;
}
[/code]
You'll be able to do something like this;
$foo = $this->get($this->Us
when code in cake,I always encounter the situation $this->User-
>findById('3')['User']['name'] ,something like that.
but it doesn't work.I know.I used to coding like this :$foo = $this-
>User->findById('3'); $foo['User']['n
49 matches
Mail list logo