Re: Dealing with forms!!!!!

2010-05-13 Thread WebbedIT
I wrote a blog post about using ModalBox which is handy if you're
using Prototype:
http://webbedit.co.uk/blog_posts/view/tutorial-cakephp-modalbox-crud

HTH

Paul.

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 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: 2 models in one view

2010-05-13 Thread Marek Sebera
Isnť it $user['UserPreference'][0]['image'] ?

Like here:

foreach($user['UserPreference'] as $user){
$img = $user['image'];
}

Mark

2010/5/14 bradmaxs 

> I know this is probably simple but I have spent a lot of time trying
> to figure this out and was hoping someone could assist.
>
> I have a user model and a user_preference model.  user_preference
> belongs to user.
>
> I am in view.ctp of the user model and in the dump I have the
> following array.
>
> Array
> (
>[User] => Array
>(
>[id] => 4
>[username] => bradmaxs
>[password] =>
>[first_name] => Bradley
>[last_name] => Mackenzie
>[street_address] =>
>[city] =>
>[state] =>
>[zip] =>
>[country] => USA
>[telephone] =>
>[email_address] =>
>[group_id] => 1
>[created] => 2010-05-03 17:33:54
>[updated] => 2010-05-09 19:53:35
>)
>
>[UserPreference] => Array
>(
>[0] => Array
>(
>[id] => 1
>[user_id] => 4
>[image] => bradmaxs.jpg
>[sex] => Male
>[birthdate] =>
>[hometown] => Pittsburgh
>[introduction] =>
>[created] => 2010-05-10 19:32:19
>[modified] => 2010-05-13 17:33:35
>)
>
>)
>
> )
>
> To display info for the user data it baked: $user['User']['username'];
> and this works great displaying the user model data.
>
> Then I want to display the user_preference data as well.
>
> It works great this way:
>
> 
>  border="0" />
> 
> 
> 
> Html->link(sprintf(__('Edit %s', true), __('User
> Preference', true)), array('controller' => 'user_preferences',
> 'action' => 'edit', $userPreference['id'])); ?>
> 
>
> But I want to take it out of the foreach loop and include it mixed
> within the user model data.  I have a lot of other models with
> relational data that I will need to do the same and I know there must
> be a way to do this without foreach everytime.
>
> I tried $user['UserPreference']['image'] and it is saying - :
> Undefined index: image.
>
> Any ideas?
>
> Thanks in advance,
>
> Brad
>
> 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 post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
S pozdravem
Marek Sebera
marek.seb...@gmail.com

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 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


Translations

2010-05-13 Thread Marcell
Hi folks,

How can I contribute to translations?

I tried to using http://translation.cakephp.org/ but either got a 'An
error has occurred. Thank you for your patience.' or a 'You do not
have rights to access this translation project.' error when selecting
the translated language.


Cheers,

Marcell

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 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


2 models in one view

2010-05-13 Thread bradmaxs
I know this is probably simple but I have spent a lot of time trying
to figure this out and was hoping someone could assist.

I have a user model and a user_preference model.  user_preference
belongs to user.

I am in view.ctp of the user model and in the dump I have the
following array.

Array
(
[User] => Array
(
[id] => 4
[username] => bradmaxs
[password] =>
[first_name] => Bradley
[last_name] => Mackenzie
[street_address] =>
[city] =>
[state] =>
[zip] =>
[country] => USA
[telephone] =>
[email_address] =>
[group_id] => 1
[created] => 2010-05-03 17:33:54
[updated] => 2010-05-09 19:53:35
)

[UserPreference] => Array
(
[0] => Array
(
[id] => 1
[user_id] => 4
[image] => bradmaxs.jpg
[sex] => Male
[birthdate] =>
[hometown] => Pittsburgh
[introduction] =>
[created] => 2010-05-10 19:32:19
[modified] => 2010-05-13 17:33:35
)

)

)

To display info for the user data it baked: $user['User']['username'];
and this works great displaying the user model data.

Then I want to display the user_preference data as well.

It works great this way:






Html->link(sprintf(__('Edit %s', true), __('User
Preference', true)), array('controller' => 'user_preferences',
'action' => 'edit', $userPreference['id'])); ?>


But I want to take it out of the foreach loop and include it mixed
within the user model data.  I have a lot of other models with
relational data that I will need to do the same and I know there must
be a way to do this without foreach everytime.

I tried $user['UserPreference']['image'] and it is saying - :
Undefined index: image.

Any ideas?

Thanks in advance,

Brad

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 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


How to handle multiple user types

2010-05-13 Thread Eric Anderson
Hi everyone,

I'm just curious how everyone else out there handles different user
types when they have different data associated with them?

I have a system that has guests, members and hosts. Each user type has
many different fields associated with them. Currently I handle it by
having a main user table that has the common data (email, username,
password) and also has a "role" field which stores what type of user
they are.

I then link my user table to the other tables using the $hasOne. In
each of my other tables (guest, member, host) I have all the
particular data associated with that member type.

While I originally felt this was the best way to handle this, I feel
like it's getting messy. Of course, I couldn't hold all those
different field types in one users table. I kept the user table as it
allows for easy integration with the Auth component (I know it can get
difficult to use Auth with many different tables holding usernames and
passwords).

Any thoughts?

Thanks!

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 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: Multiple AJAX Forms on same page all submitting to first form.

2010-05-13 Thread Nabil Alsharif
Are you calling $form->end()?

On Thu, May 13, 2010 at 9:54 AM, Robert McWay <
mcway.web.developm...@gmail.com> wrote:

> i had already fixed that issue since i posted this initially, and that
> wasn't the issue. I actually did get it working now, by switching to
> using $ajax->form, instead of $ajax->submit(). The downside is data
> validation doesn't work with $ajax->form, but at least the form tags
> are being generated properly. Thanks Guys.
>
> On May 12, 9:46 am, John Andersen  wrote:
> > As Nilz wrote, you have two keys with the name of "id" in your array!
> > That can't work!
> > So check you form create statement and correct it!
> > Enjoy,
> >John
> >
> > On May 12, 7:17 pm, Robert McWay 
> > wrote:> I took another look at the generated HTML, like you suggested
> Matt,
> > > and found something very strange. The multiple forms i have on this
> > > page are being generated by a loop. It appears that the first form
> > > generates the proper opening and closing form tags, along with the
> > > javascript for the AJAX. But then looking at the 2nd and 3rd forms in
> > > the code, i realized that the opening form tag is not being inserted,
> > > as well as the closing form tag, The submit button and proper
> > > javascript are still being generated, but for some reason the form
> > > tags just don't generate past the first form. Any idea why?
> >
> > [snip]
> >
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
> >
> > 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.comFor
> >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
>
> 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 post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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: BAKE Cake SPAM

2010-05-13 Thread calvin
That's no good, but are you sure it's targeting CakePHP and not just
any sites based on an MVC framework or that use RESTful URLs? That's a
pretty standard routing pattern these days (I assume you meant to say
"/admin/model/action", not "/model/admin/action"), and I'm pretty sure
that more than a few frameworks/CMSes use it.

But regardless of whether Cake sites are being targeted by spammers or
not, you shouldn't have a public website with unprotected admin URLs.
If you're using admin routing, then you can just use the Auth
component, which will restrict access to all actions except for login/
logout, and then specifically allow the public actions you need to
give access to. That way, you'll never have any unprotected admin URLs
that you simply forgot about removing or protecting.

On May 13, 4:36 am, Stuart Cross 
wrote:
> I have seen evidence of SPAM spiders hunting for BAKE'd Cake sites
> with unprotected admin urls. They are simply using the model names
> from urls and hitting model/admin/add model/admin/edit/n in the access
> logs. May seem obvious but check you lock down your admin methods and
> remove unwanted baked methods. We did actually get hit by this but the
> table was overwritten hourly from an external source so took us a
> while to notice (Forgot to remove the un-needed baked controller).
>
> Anyone else seen CakePHP directly targetted by SPAMers / Hackers?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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: Multiple AJAX Forms on same page all submitting to first form.

2010-05-13 Thread Robert McWay
i had already fixed that issue since i posted this initially, and that
wasn't the issue. I actually did get it working now, by switching to
using $ajax->form, instead of $ajax->submit(). The downside is data
validation doesn't work with $ajax->form, but at least the form tags
are being generated properly. Thanks Guys.

On May 12, 9:46 am, John Andersen  wrote:
> As Nilz wrote, you have two keys with the name of "id" in your array!
> That can't work!
> So check you form create statement and correct it!
> Enjoy,
>    John
>
> On May 12, 7:17 pm, Robert McWay 
> wrote:> I took another look at the generated HTML, like you suggested Matt,
> > and found something very strange. The multiple forms i have on this
> > page are being generated by a loop. It appears that the first form
> > generates the proper opening and closing form tags, along with the
> > javascript for the AJAX. But then looking at the 2nd and 3rd forms in
> > the code, i realized that the opening form tag is not being inserted,
> > as well as the closing form tag, The submit button and proper
> > javascript are still being generated, but for some reason the form
> > tags just don't generate past the first form. Any idea why?
>
> [snip]
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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


BAKE Cake SPAM

2010-05-13 Thread Stuart Cross
I have seen evidence of SPAM spiders hunting for BAKE'd Cake sites
with unprotected admin urls. They are simply using the model names
from urls and hitting model/admin/add model/admin/edit/n in the access
logs. May seem obvious but check you lock down your admin methods and
remove unwanted baked methods. We did actually get hit by this but the
table was overwritten hourly from an external source so took us a
while to notice (Forgot to remove the un-needed baked controller).

Anyone else seen CakePHP directly targetted by SPAMers / Hackers?

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 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 write update query in cakephp

2010-05-13 Thread Jeremy Burns
Here's a clue:

> duplicate key value violates unique constraint "tblcdlog_pkey"

You are trying to create a duplicate row in the database.

Jeremy Burns
jeremybu...@me.com


On 13 May 2010, at 14:00, Narendra Padala wrote:

> Warning (512): SQL Error: ERROR:  duplicate key value violates unique 
> constraint "tblcdlog_pkey" [CORE/cake/libs/model/datasources/dbo_source.php, 
> line 526]
> 
> 
> 
> 
> On Thu, May 13, 2010 at 6:28 PM, Jeremy Burns  wrote:
> I'm sorry to sound unhelpful, but have you read the error message?
> 
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 13 May 2010, at 13:53, Narendra Padala wrote:
> 
>> hi sir,
>> i did that one now i got this error sir please help me out sir
>> 
>> Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:  duplicate 
>> key value violates unique constraint "tblcdlog_pkey" 
>> [CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155]
>> 
>> 
>> Code | Context
>> $sql =   "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", 
>> "lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', 
>> '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
>> pg_query - [internal], line ??
>> DboPostgres::_execute() - 
>> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 189
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>> TblstoresController::datacdload() - 
>> APP/controllers/tblstores_controller.php, line 1037
>> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
>> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
>> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
>> [main] - APP/webroot/index.php, line 87
>> Warning (512): SQL Error: ERROR:  duplicate key value violates unique 
>> constraint "tblcdlog_pkey" [CORE/cake/libs/model/datasources/dbo_source.php, 
>> line 526]
>> 
>> 
>> Code | Context
>> $sql =   "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", 
>> "lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', 
>> '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
>> $error   =   "ERROR:  duplicate key value violates unique constraint 
>> "tblcdlog_pkey""
>> $out =   null
>> $out = null;
>> if ($error) {
>> trigger_error("> \"color:Red;text-align:left\">SQL Error: {$this->error}", 
>> E_USER_WARNING);
>> DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, 
>> line 526
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 202
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>> TblstoresController::datacdload() - 
>> APP/controllers/tblstores_controller.php, line 1037
>> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
>> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
>> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
>> [main] - APP/webroot/index.php, line 87
>> Query: INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", "lngcdlog_type", 
>> "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', '2010-05-13 
>> 13:42:50', '1', '0', '124', 'Naru') 
>> 
>> 
>> 
>> 
>> 
>> I wrote code like this...
>> 
>> $this->data['Tblcdlog']['lngcdlog']=157;
>> $this->data['Tblcdlog']['dtmcreated']='2010-05-13 13:42:50';
>> $this->data['Tblcdlog']['lngcdlog_type']=1;
>> $this->data['Tblcdlog']['blnsuccess']=0;
>> $this->data['Tblcdlog']['tblcdlog_id']=124;
>> $this->data['Tblcdlog']['strerrordesc']='Naru';
>> 
>> 
>> $this->Tblcdlog->save($this->data);
>> 
>> Please help me out sir
>> 
>> 
>> On Thu, May 13, 2010 at 6:10 PM, Jeremy Burns  wrote:
>> That's a fairly self explanatory error message. Your dtmcreated field cannot 
>> be null. You need to include the dtmcreatedthild and a matching value in the 
>> update statement.
>> 
>> Something like:
>> 
>>> $this->data['Tblcdlog']['lngcdlog']=157;
>>> $this->data['Tblcdlog']['strerrordesc']='value';
>>> 
>>> 
>>> 
>>> $this->data['Tblcdlog']['dtmcreated']='value';
>>> 
>>> $this->Tblcdlog->save($this->data);
>>> 
>> 
>> 
>> Jeremy Burns
>> jeremybu...@me.com
>> 
>> 
>> On 13 May 2010, at 13:36, Narendra Padala wrote:
>> 
>>> when i am tried above like that, i got this error message
>>> 
>>> Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:  null 
>>> value in column "dtmcreated" violates not-null constraint 
>>> [CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155]
>>> 
>>> 
>>> 
>>> Code | Context
>>> $sql=   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") 
>>> VALUES ('157', 'value')"
>>> pg_query - [internal], line ??
>>> DboPostgres::_execute() - 

Re: how write update query in cakephp

2010-05-13 Thread Narendra Padala
*Warning* (512): *SQL Error:* ERROR:  duplicate key value violates
unique constraint "tblcdlog_pkey"
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]



On Thu, May 13, 2010 at 6:28 PM, Jeremy Burns  wrote:

> I'm sorry to sound unhelpful, but have you read the error message?
>
>
> Jeremy Burns
> jeremybu...@me.com 
>
>
> On 13 May 2010, at 13:53, Narendra Padala wrote:
>
> hi sir,
> i did that one now i got this error sir please help me out sir
>
> *Warning* (2): pg_query() [function.pg-query 
> ]: Query failed: ERROR:  duplicate key 
> value violates unique constraint "tblcdlog_pkey" 
> [*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]
>
> Code | Context
>
> $sql  =   "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", 
> "lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', 
> '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
>
> pg_query - [internal], line ??
> DboPostgres::_execute() - 
> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 189
> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 586
> Model::save() - CORE/cake/libs/model/model.php, line 1287
> TblstoresController::datacdload() - APP/controllers/tblstores_controller.php, 
> line 1037
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
> [main] - APP/webroot/index.php, line 87
>
> *Warning* (512): *SQL Error:* ERROR:  duplicate key value violates unique 
> constraint "tblcdlog_pkey" 
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]
>
> Code | Context
>
> $sql  =   "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", 
> "lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', 
> '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
> $error=   "ERROR:  duplicate key value violates unique constraint 
> "tblcdlog_pkey""
> $out  =   null
>
> $out = null;if ($error) {
> trigger_error("SQL Error: 
> {$this->error}", E_USER_WARNING);
>
> DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, 
> line 526
> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 202
> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 586
> Model::save() - CORE/cake/libs/model/model.php, line 1287
> TblstoresController::datacdload() - APP/controllers/tblstores_controller.php, 
> line 1037
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
> [main] - APP/webroot/index.php, line 87
>
> *Query:* INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", "lngcdlog_type", 
> "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', '2010-05-13 
> 13:42:50', '1', '0', '124', 'Naru')
>
>
>
> I wrote code like this...
>
> $this->data['Tblcdlog']['lngcdlog']=157;
> $this->data['Tblcdlog']['dtmcreated']='2010-05-13
> 13:42:50';
> $this->data['Tblcdlog']['lngcdlog_type']=1;
> $this->data['Tblcdlog']['blnsuccess']=0;
> $this->data['Tblcdlog']['tblcdlog_id']=124;
> $this->data['Tblcdlog']['strerrordesc']='Naru';
>
>
> $this->Tblcdlog->save($this->data);
>
> Please help me out sir
>
>
> On Thu, May 13, 2010 at 6:10 PM, Jeremy Burns  wrote:
>
>> That's a fairly self explanatory error message. Your dtmcreated field
>> cannot be null. You need to include the dtmcreatedthild and a matching value
>> in the update statement.
>>
>> Something like:
>>
>> $this->data['Tblcdlog']['lngcdlog']=157;
>> $this->data['Tblcdlog']['strerrordesc']='value';
>>
>> *$this->data['Tblcdlog']['dtmcreated']='value';*
>>
>> $this->Tblcdlog->save($this->data);
>>
>>
>>
>> Jeremy Burns
>> jeremybu...@me.com 
>>
>>
>> On 13 May 2010, at 13:36, Narendra Padala wrote:
>>
>> when i am tried above like that, i got this error message
>>
>> *Warning* (2): pg_query() [function.pg-query 
>> ]: Query failed: ERROR:  null value in 
>> column "dtmcreated" violates not-null constraint 
>> [*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]
>>
>>  Code | Context
>>
>> $sql =   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
>> ('157', 'value')"
>>
>> pg_query - [internal], line ??
>> DboPostgres::_execute() - 
>> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 189
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>>

Re: how write update query in cakephp

2010-05-13 Thread Jeremy Burns
I'm sorry to sound unhelpful, but have you read the error message?

Jeremy Burns
jeremybu...@me.com


On 13 May 2010, at 13:53, Narendra Padala wrote:

> hi sir,
> i did that one now i got this error sir please help me out sir
> 
> Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:  duplicate 
> key value violates unique constraint "tblcdlog_pkey" 
> [CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155]
> 
> Warning (512): SQL Error: ERROR:  duplicate key value violates unique 
> constraint "tblcdlog_pkey" [CORE/cake/libs/model/datasources/dbo_source.php, 
> line 526]
> 
> Query: INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated", "lngcdlog_type", 
> "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES ('157', '2010-05-13 
> 13:42:50', '1', '0', '124', 'Naru') 
> 
> 
> 
> 
> I wrote code like this...
> 
> $this->data['Tblcdlog']['lngcdlog']=157;
> $this->data['Tblcdlog']['dtmcreated']='2010-05-13 13:42:50';
> $this->data['Tblcdlog']['lngcdlog_type']=1;
> $this->data['Tblcdlog']['blnsuccess']=0;
> $this->data['Tblcdlog']['tblcdlog_id']=124;
> $this->data['Tblcdlog']['strerrordesc']='Naru';
> 
> 
> $this->Tblcdlog->save($this->data);
> 
> Please help me out sir
> 
> 
> On Thu, May 13, 2010 at 6:10 PM, Jeremy Burns  wrote:
> That's a fairly self explanatory error message. Your dtmcreated field cannot 
> be null. You need to include the dtmcreatedthild and a matching value in the 
> update statement.
> 
> Something like:
> 
>> $this->data['Tblcdlog']['lngcdlog']=157;
>> $this->data['Tblcdlog']['strerrordesc']='value';
>> 
>> 
>> $this->data['Tblcdlog']['dtmcreated']='value';
>> 
>> $this->Tblcdlog->save($this->data);
>> 
> 
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 13 May 2010, at 13:36, Narendra Padala wrote:
> 
>> when i am tried above like that, i got this error message
>> 
>> Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:  null 
>> value in column "dtmcreated" violates not-null constraint 
>> [CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155]
>> 
>> 
>> Code | Context
>> $sql =   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
>> ('157', 'value')"
>> pg_query - [internal], line ??
>> DboPostgres::_execute() - 
>> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 189
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>> TblstoresController::datacdload() - 
>> APP/controllers/tblstores_controller.php, line 1031
>> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
>> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
>> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
>> [main] - APP/webroot/index.php, line 87
>> Warning (512): SQL Error: ERROR:  null value in column "dtmcreated" violates 
>> not-null constraint [CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 526]
>> 
>> 
>> Code | Context
>> $sql =   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
>> ('157', 'value')"
>> $error   =   "ERROR:  null value in column "dtmcreated" violates 
>> not-null constraint"
>> $out =   null
>> $out = null;
>> if ($error) {
>> trigger_error("> \"color:Red;text-align:left\">SQL Error: {$this->error}", 
>> E_USER_WARNING);
>> DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, 
>> line 526
>> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 202
>> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
>> 586
>> Model::save() - CORE/cake/libs/model/model.php, line 1287
>> TblstoresController::datacdload() - 
>> APP/controllers/tblstores_controller.php, line 1031
>> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
>> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
>> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
>> [main] - APP/webroot/index.php, line 87
>> Query: INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES ('157', 
>> 'value') 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> this is my table structure
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>Table "public.tblcdlog"
>>  Column  |Type |  
>> Modifiers  
>> 
>> 
>> -+-+-
>>  lngcdlog| integer | not null default 
>> nextval('tblcdlog_lngcdlog_seq'::regclass)
>> 
>> 
>>  dtmcreated  | timestamp without time zone | not null
>>  strcdno | character varying(50)   | 
>>  strversion  | character 

Re: how write update query in cakephp

2010-05-13 Thread Narendra Padala
hi sir,
i did that one now i got this error sir please help me out sir

*Warning* (2) : pg_query() [function.pg-query
]: Query failed: ERROR:  duplicate
key value violates unique constraint "tblcdlog_pkey"
[*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]

Code  | Context 

$sql=   "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated",
"lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES
('157', '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"

pg_query - [internal], line ??
DboPostgres::_execute() -
CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 189
DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 586
Model::save() - CORE/cake/libs/model/model.php, line 1287
TblstoresController::datacdload() -
APP/controllers/tblstores_controller.php, line 1037
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
[main] - APP/webroot/index.php, line 87

*Warning* (512) : *SQL Error:* ERROR:  duplicate
key value violates unique constraint "tblcdlog_pkey"
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]

Code  | Context 

$sql=   "INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated",
"lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES
('157', '2010-05-13 13:42:50', '1', '0', '124', 'Naru')"
$error  =   "ERROR:  duplicate key value violates unique constraint
"tblcdlog_pkey""
$out=   null

$out = null;if ($error) {
trigger_error("SQL
Error: {$this->error}", E_USER_WARNING);

DboSource::showQuery() -
CORE/cake/libs/model/datasources/dbo_source.php, line 526
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 202
DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 586
Model::save() - CORE/cake/libs/model/model.php, line 1287
TblstoresController::datacdload() -
APP/controllers/tblstores_controller.php, line 1037
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
[main] - APP/webroot/index.php, line 87

*Query:* INSERT INTO "tblcdlog" ("lngcdlog", "dtmcreated",
"lngcdlog_type", "blnsuccess", "tblcdlog_id", "strerrordesc") VALUES
('157', '2010-05-13 13:42:50', '1', '0', '124', 'Naru')



I wrote code like this...

$this->data['Tblcdlog']['lngcdlog']=157;
$this->data['Tblcdlog']['dtmcreated']='2010-05-13 13:42:50';
$this->data['Tblcdlog']['lngcdlog_type']=1;
$this->data['Tblcdlog']['blnsuccess']=0;
$this->data['Tblcdlog']['tblcdlog_id']=124;
$this->data['Tblcdlog']['strerrordesc']='Naru';


$this->Tblcdlog->save($this->data);

Please help me out sir


On Thu, May 13, 2010 at 6:10 PM, Jeremy Burns  wrote:

> That's a fairly self explanatory error message. Your dtmcreated field
> cannot be null. You need to include the dtmcreatedthild and a matching value
> in the update statement.
>
> Something like:
>
> $this->data['Tblcdlog']['lngcdlog']=157;
> $this->data['Tblcdlog']['strerrordesc']='value';
>
> *$this->data['Tblcdlog']['dtmcreated']='value';*
>
> $this->Tblcdlog->save($this->data);
>
>
>
> Jeremy Burns
> jeremybu...@me.com 
>
>
> On 13 May 2010, at 13:36, Narendra Padala wrote:
>
> when i am tried above like that, i got this error message
>
> *Warning* (2): pg_query() [function.pg-query 
> ]: Query failed: ERROR:  null value in 
> column "dtmcreated" violates not-null constraint 
> [*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]
>
> Code | Context
>
> $sql  =   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
> ('157', 'value')"
>
> pg_query - [internal], line ??
> DboPostgres::_execute() - 
> CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
> DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 189
> DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 
> 586
> Model::save() - CORE/cake/libs/model/model.php, line 1287
> TblstoresController::datacdload() - APP/controllers/tblstores_controller.php, 
> line 1031
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
> [main] - APP/webroot/index.php, line 87
>
> *Warning* (512): *SQL Error:* ERROR:  null value in column "dtmcreated" 
> violates not-null constraint 
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]
>
> Code | Context
>
> $sql  =   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES 
> ('157', 'value

CakePHP ERA modeler

2010-05-13 Thread Ziki
Hello, once I have been finded ERA modeler especialy for CakePHP
conventions, and now I can't find that website, does anybody know what
is URL of that site or is there any similar?

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 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 write update query in cakephp

2010-05-13 Thread Jeremy Burns
That's a fairly self explanatory error message. Your dtmcreated field cannot be 
null. You need to include the dtmcreated field and a matching value in the 
update statement.

Something like:

> $this->data['Tblcdlog']['lngcdlog']=157;
> $this->data['Tblcdlog']['strerrordesc']='value';
> 
> $this->data['Tblcdlog']['dtmcreated']='value';
> 
> $this->Tblcdlog->save($this->data);
> 


Jeremy Burns
jeremybu...@me.com


On 13 May 2010, at 13:36, Narendra Padala wrote:

> when i am tried above like that, i got this error message
> 
> Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:  null value 
> in column "dtmcreated" violates not-null constraint 
> [CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155]
> 
> Warning (512): SQL Error: ERROR:  null value in column "dtmcreated" violates 
> not-null constraint [CORE/cake/libs/model/datasources/dbo_source.php, line 
> 526]
> 
> Query: INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES ('157', 
> 'value') 
> 
> 
> 
> 
> 
> 
> this is my table structure
> 
> 
> 
> 
> 
> 
>Table "public.tblcdlog"
>  Column  |Type |  
> Modifiers  
> 
> -+-+-
>  lngcdlog| integer | not null default 
> nextval('tblcdlog_lngcdlog_seq'::regclass)
> 
>  dtmcreated  | timestamp without time zone | not null
>  strcdno | character varying(50)   | 
>  strversion  | character varying(50)   | 
>  lngcdlog_type   | integer | not null
> 
>  blnsuccess  | bit(1)  | not null
>  strerrordesc| character varying(255)  | 
>  strupdateno | character varying(10)   | 
>  blnlogged_to_rr | boolean | not null default false
> 
>  tblcdlog_id | integer | not null default 
> nextval('tblcdlog_id_seq'::regclass)
> Indexes:
> "tblcdlog_pkey" PRIMARY KEY, btree (lngcdlog)
> Foreign-key constraints:
> "tblcdlog_lngcdlog_type_fkey" FOREIGN KEY (lngcdlog_type) REFERENCES 
> tlkcdlog_type(lngcdlog_type)
> 
> 
> --
> 
> 
> 
> i wrote code like this
> 
> 
> 
> 
> $this->data['Tblcdlog']['lngcdlog']=157;
> $this->data['Tblcdlog']['strerrordesc']='value';
> $this->Tblcdlog->save($this->data);
> 
> 
> 
> 
> 
> Please any one help me out
> 
> 
> 
> 
> On Thu, May 13, 2010 at 4:46 PM, Dilip Godhani  
> wrote:
> Hi,
> Suppose u want to update one row and its id is 1
> then u want
> following array
> $this->data['ModdelName']['id']=1;
> $this->data['ModdelName']['2field']='value';
> 
> 
> $this->ModelName->save($this->data);
> 
> 
> Array
> (
> [ModelName] => Array
> (
> [id] => 1
> [2field] => 'value'
> )
> )
> 
> 
> 
> 
>  
> 
> On Thu, May 13, 2010 at 3:52 PM, Narendra Padala  
> wrote:
> 
>  Sir, looked at sir, but i am not getting properly, can u write one example 
> for my above code..please help me out sir
> 
> On Thu, May 13, 2010 at 3:31 PM, Jeremy Burns  wrote:
> Have you even looked at the online guide? 
> http://book.cakephp.org/view/1031/Saving-Your-Data
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 13 May 2010, at 11:00, Narendra Padala wrote:
> 
> >
> > Hi...All!,
> >
> > I am new to cake php,I am suing postgreSql i need to update some
> > fields in my database. In my controller my code like thishere i
> > need convert these update command to cake, Please anyone can help me
> > out how to convert this in to cake.
> >
> >
> > function fun() {
> >
> > /**
> > ( 1 )**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not be
> > mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
> > lngcdlog = $lngCDLog");
> >
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> > (2)/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> > **(3)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> > sufficient space on your hard drive.' WHERE

Re: how write update query in cakephp

2010-05-13 Thread Narendra Padala
when i am tried above like that, i got this error message

*Warning* (2) : pg_query() [function.pg-query
]: Query failed: ERROR:  null value
in column "dtmcreated" violates not-null constraint
[*CORE/cake/libs/model/datasources/dbo/dbo_postgres.php*, line *155*]

Code  | Context 

$sql=   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES
('157', 'value')"

pg_query - [internal], line ??
DboPostgres::_execute() -
CORE/cake/libs/model/datasources/dbo/dbo_postgres.php, line 155
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 189
DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 586
Model::save() - CORE/cake/libs/model/model.php, line 1287
TblstoresController::datacdload() -
APP/controllers/tblstores_controller.php, line 1031
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
[main] - APP/webroot/index.php, line 87

*Warning* (512) : *SQL Error:* ERROR:  null value
in column "dtmcreated" violates not-null constraint
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]

Code  | Context 

$sql=   "INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES
('157', 'value')"
$error  =   "ERROR:  null value in column "dtmcreated" violates not-null
constraint"
$out=   null

$out = null;if ($error) {
trigger_error("SQL
Error: {$this->error}", E_USER_WARNING);

DboSource::showQuery() -
CORE/cake/libs/model/datasources/dbo_source.php, line 526
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 202
DboSource::create() - CORE/cake/libs/model/datasources/dbo_source.php, line 586
Model::save() - CORE/cake/libs/model/model.php, line 1287
TblstoresController::datacdload() -
APP/controllers/tblstores_controller.php, line 1031
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
[main] - APP/webroot/index.php, line 87

*Query:* INSERT INTO "tblcdlog" ("lngcdlog", "strerrordesc") VALUES
('157', 'value')



this is my table structure




   Table "public.tblcdlog"
 Column  |Type |
   Modifiers
-+-+-
 lngcdlog| integer | not null default
nextval('tblcdlog_lngcdlog_seq'::regclass)
 dtmcreated  | timestamp without time zone | not null
 strcdno | character varying(50)   |
 strversion  | character varying(50)   |
 lngcdlog_type   | integer | not null
 blnsuccess  | bit(1)  | not null
 strerrordesc| character varying(255)  |
 strupdateno | character varying(10)   |
 blnlogged_to_rr | boolean | not null default false
 tblcdlog_id | integer | not null default
nextval('tblcdlog_id_seq'::regclass)
Indexes:
"tblcdlog_pkey" PRIMARY KEY, btree (lngcdlog)
Foreign-key constraints:
"tblcdlog_lngcdlog_type_fkey" FOREIGN KEY (lngcdlog_type)
REFERENCES tlkcdlog_type(lngcdlog_type)

--


i wrote code like this


$this->data['Tblcdlog']['lngcdlog']=157;
$this->data['Tblcdlog']['strerrordesc']='value';
$this->Tblcdlog->save($this->data);



Please any one help me out



On Thu, May 13, 2010 at 4:46 PM, Dilip Godhani wrote:

> Hi,
> Suppose u want to update one row and its id is 1
> then u want
> following array
>
> $this->data['ModdelName']['id']=1;
> $this->data['ModdelName']['2field']='value';
>
> $this->ModelName->save($this->data);
>
>
> Array
> (
> [ModelName] => Array
> (
> [id] => 1
> [2field] => 'value'
> )
> )
>
>
>
>
> On Thu, May 13, 2010 at 3:52 PM, Narendra Padala 
> wrote:
>
>>
>>  Sir, looked at sir, but i am not getting properly, can u write one
>> example for my above code..please help me out sir
>>
>> On Thu, May 13, 2010 at 3:31 PM, Jeremy Burns  wrote:
>>
>>> Have you even looked at the online guide?
>>> http://book.cakephp.org/view/1031/Saving-Your-Data
>>>
>>> Jeremy Burns
>>> jeremybu...@me.com
>>>
>>>
>>> On 13 May 2010, at 11:00, Narendra Padala wrote:
>>>
>>> >
>>> > Hi...All!,
>>> >
>>> > I am new to cake php,I am suing postgreSql i need to update some
>>> > fields in my database. In my controller my code like thishere i
>>> > need convert these update command to cake, Please anyone can help me
>>> > out how to convert this in to cake.
>>> >
>>> >
>>> > function fun() {
>>> >
>>> > /**
>>> > ( 1 )**/
>>> > pg_exec($

Re: Rewrite url in cakephp

2010-05-13 Thread
Couple of ways to do this:

1) Rename the file to 'admin_controller' and change var $name to
admin. You might need to set var $uses to Admin in this case.

2) THE PREFERRED WAY - open up Config/routes.php and set yourself
another route in there. The notes in the file should see you through,
it is well documented.

J

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 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: Authorizing problems with Auth compoment.

2010-05-13 Thread
Have a look in the book for the isAuthorized() function - you need
that if you are authorizing by controller.

Without that present (it can be in AppController if you have very
simple needs) then you won't have much luck.

J

On May 13, 2:11 am, still  wrote:
> The problem confucing me is that when i using Auth, every action that
> i not allowed in the
>
> Auth->allow()
> will be access denied even after i loged in with a correct username
> and password.
> Am i missunderstanding the usage of Auth component?  only the allowed
> actions can be accessed?
>
> /* app/app_controller */
>         var $components = array('Auth');
>
>         function beforeFilter()
>         {
>
>                 $this->Auth->fields = array('username' => 'email', 'password' 
> =>
> 'password');
>
>                 $this->Auth->loginAction = array('controller' => 'users', 
> 'action'
> => 'login');
>
>                 $this->Auth->loginRedirect = array('controller' => 'users', 
> 'action'
> => 'home');
>
>                 $this->Auth->logoutRedirect = '/';
>
>                 $this->Auth->loginError = 'Invalid e-mail / password 
> combination.
> Please try again';
>
>                 $this->Auth->authorize = 'controller';
>
>         }
>
> /*==im a seperator ==*/
>
> /*users controller*/
>         var $name = 'Users';
>         var $components = array('Session');
>
>         function beforeFilter(){
>                 $this->Auth->allow('login','logout','signup');
>                 parent::beforeFilter();
>         }
>
>         function login()
>         {
>         // its blank.
>
>         }
>                 function home()
>                 {
>                  // do somthing homepage.
>                 }
>
> with these codes, when i sign in with a correct account, it will
> successfully sign in then redirected to users/home action, but because
> 'home' action is not in the allow list , it's again redirected to the
> loginAction with a flash message of 'You are not authorized to access
> that location'(other not allowed actions for the same). But if i put
> home action in the $this->Auth->allow(), it will be displayed well
> with the correct user informations
>
> By my understanding of Auth component, it should be displaying home
> action cause ive already logged in. Am i wrong or doing something in a
> wrong way ?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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


Rewrite url in cakephp

2010-05-13 Thread Jipson
Hello friends,
   In my site created using cake php, I can access my sites admin
control panel login by http://mysite.com/admins/login.
admins_controller is the controller and login is the function name.
How I can acces the same by http://mysite.com/admin/login? Can you
please help me?

Thanks,
Jipson

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 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


Rewrite url in cakephp

2010-05-13 Thread Jipson

Hello friends,
   In my site created using cake php, I can access my sites admin control
panel login by http://mysite.com/admins/login. admins_controller is the
controller and login is the function name. How I can acces the same by
http://mysite.com/admin/login? Can you please help me?

Thanks,
Jipson
-- 
View this message in context: 
http://old.nabble.com/Rewrite-url-in-cakephp-tp28546818p28546818.html
Sent from the CakePHP mailing list archive at Nabble.com.

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 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: Dealing with forms!!!!!

2010-05-13 Thread
This isn't too tricky to fix.

Essentially you want to reload the form if registration fails? Like
Paul said above, you need to be doing the validation in the Model, and
use the Model->validates() method to test for it.

So, if you build the validation criteria in the model (have a look at
the Book if you don't know how, it explains it well), then you need to
control registration using a simple if statement in the controller:

if($this->Model->validates()) {
//do registration logic here e.g.
   $this->Model->create();
   if($this->Model->save($this->data)) {
 //do stuff for successful registration here
   }
}
// since we didn't trigger the validates = true, the data didn't
validate so just reload the controller, which will be filled
automagically with
// validation errors


I hope that makes sense? Then making it reappear in the lightbox is
just a case of ensuring that your lightbox script supports loading new
content from within it. I like colorbox, personally, but there are
lots of great scripts!

Hope that helps,

J




On May 13, 8:43 am, sherzo  wrote:
> Hi Paul
>
> Thanks for your reply and the great comment about the validation. My main
> issue is, the registration form is included in a light box and after
> submission I dont like it to be redirected to another page in case of any
> error especially of user turned off the javascript in the browser !
>
> Thanks
> Sherry
>
>
>
>
>
> WebbedIT wrote:
>
> > Hmm, your doing all of your validation manually in the controller ...
> > this is supposed to be done automagically by the model when you save
> > the record.
>
> > Read the following through a couple of times:
>
> >http://book.cakephp.org/view/125/Data-Validation
>
> > The one thing you have to watch out for is the password field which is
> > automatically hashed by the Auth component, so to check if
> > password_confirm matches password you also need to hash the
> > password_confirm field.  It's easy to do this using a custom
> > validation function such as
>
> > User Model:
> > ...
> > var $validate = array(
> >   'username' => array(
> >     'isUnique' => array(
> >       'rule' => 'isUnique',
> >       'message' => 'Sorry, this username has been taken, please try
> > another',
> >       'last' => true
> >     ),
> >     'validChars' => array(
> >       'rule' => '/^[a-z0-9_]{1,}$/i',
> >       'message' => 'Can only include letters, numbers and underscores'
> >     )
> >   ),
> >   'password_confirm' => array(
> >     'notEmpty' => array(
> >       'rule' => array('notEmpty'),
> >       'message' => 'This field cannot be left blank',
> >       'on' => 'create',
> >       'last' => true
> >     ),
> >     'confirm' => array(
> >       'rule' => array('validateConfirmPassword'),
> >       'message' => 'Password confirmation does not match'
> >     )
> >   )
> > );
>
> > function __validateConfirmPassword($field) {
> >   $valid = false;
> >   if ($this->data['User']['password'] ==
> > Security::hash(Configure::read('Security.salt') .
> > $field['password_confirm'])) {
> >     $valid = true;
> >   }
> >   return $valid;
> > }
> > ...
>
> > HTH
>
> > Paul.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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
> > athttp://groups.google.com/group/cake-php?hl=en
>
> --
> View this message in 
> context:http://old.nabble.com/Dealing-with-forms%21%21%21%21%21-tp28541795p28...
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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 write update query in cakephp

2010-05-13 Thread Dilip Godhani
Hi,
Suppose u want to update one row and its id is 1
then u want
following array

$this->data['ModdelName']['id']=1;
$this->data['ModdelName']['2field']='value';

$this->ModelName->save($this->data);


Array
(
[ModelName] => Array
(
[id] => 1
[2field] => 'value'
)
)




On Thu, May 13, 2010 at 3:52 PM, Narendra Padala wrote:

>
>  Sir, looked at sir, but i am not getting properly, can u write one example
> for my above code..please help me out sir
>
> On Thu, May 13, 2010 at 3:31 PM, Jeremy Burns  wrote:
>
>> Have you even looked at the online guide?
>> http://book.cakephp.org/view/1031/Saving-Your-Data
>>
>> Jeremy Burns
>> jeremybu...@me.com
>>
>>
>> On 13 May 2010, at 11:00, Narendra Padala wrote:
>>
>> >
>> > Hi...All!,
>> >
>> > I am new to cake php,I am suing postgreSql i need to update some
>> > fields in my database. In my controller my code like thishere i
>> > need convert these update command to cake, Please anyone can help me
>> > out how to convert this in to cake.
>> >
>> >
>> > function fun() {
>> >
>> > /**
>> > ( 1 )**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not be
>> > mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
>> > lngcdlog = $lngCDLog");
>> >
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> (2)/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
>> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> **(3)**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
>> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> **(4)**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD is not a
>> > valid $COMPANY_NAME data CD.' WHERE lngcdlog = $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> **(5)**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD may not be
>> > loaded in this $DEST_NAME.' WHERE lngcdlog = $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> **(6)**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strcdno = '$identifiercode' WHERE
>> > lngcdlog = $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> **(7)**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'Invalid
>> > $COMPANY_NAME CD-Rom ID Code.' WHERE lngcdlog = $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n");
>> > fclose($fError);
>> >
>> > /
>> >
>> **(8)**/
>> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD has already
>> > been loaded, and may not be loaded again.' WHERE lngcdlog =
>> > $lngCDLog");
>> >
>> > /*** Here some content related to our script
>> > */
>> > $fError = fopen("/tmp/errorlog", "a+");
>> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
>> > \n\n")

Re: i18n / l10n Problem with Cake 1.3

2010-05-13 Thread nils
Miles, thanks a bunch, that was it.

Damn, I lost a whole day on that.. Documentation should really be
improved here! :/

I'll be heading over to book.cakephp.org right away and add that to
the i18n section as a comment..

Have a good one!

nils


On May 12, 7:16 pm, Miles J  wrote:
> If you want German, its "deu" and not "ger". I ran into this problem
> also.
>
> On May 12, 8:53 am, John Andersen  wrote:
>
>
>
>
>
> > Check that your directory names and file names are in the expected
> > case (upper/lower)!
> > Ensure that CakePHP have read access to the directories!
> > Hope this helps you,
> >    John
>
> > On May 12, 5:35 pm, nils  wrote:
>
> > > Hi all,
>
> > > ok, I got:
>
> > > - "Configure::write('Config.language', 'ger');" in bootstrap (tried
> > > core, too!)
> > > - "C:\stuff\xampp\htdocs\caketest\app\locale\ger\LC_MESSAGES
> > > \default.po" in place (pot created with cake i18n, renamed to .po)
> > > - "" in my ctp
>
> > > ..and it still doesn't work!
>
> > > Drives me insane, I must be missing some ultra-important thing here,
> > > though there aren't even any error messages!
>
> > > Help, pretty please! :)
>
> > > nils
>
> > > ps: and it won't use my english .po either.. :/
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > 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 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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 write update query in cakephp

2010-05-13 Thread Narendra Padala
 Sir, looked at sir, but i am not getting properly, can u write one example
for my above code..please help me out sir
On Thu, May 13, 2010 at 3:31 PM, Jeremy Burns  wrote:

> Have you even looked at the online guide?
> http://book.cakephp.org/view/1031/Saving-Your-Data
>
> Jeremy Burns
> jeremybu...@me.com
>
>
> On 13 May 2010, at 11:00, Narendra Padala wrote:
>
> >
> > Hi...All!,
> >
> > I am new to cake php,I am suing postgreSql i need to update some
> > fields in my database. In my controller my code like thishere i
> > need convert these update command to cake, Please anyone can help me
> > out how to convert this in to cake.
> >
> >
> > function fun() {
> >
> > /**
> > ( 1 )**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not be
> > mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
> > lngcdlog = $lngCDLog");
> >
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> (2)/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(3)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> > sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(4)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD is not a
> > valid $COMPANY_NAME data CD.' WHERE lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(5)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD may not be
> > loaded in this $DEST_NAME.' WHERE lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(6)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strcdno = '$identifiercode' WHERE
> > lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(7)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'Invalid
> > $COMPANY_NAME CD-Rom ID Code.' WHERE lngcdlog = $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(8)**/
> > pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD has already
> > been loaded, and may not be loaded again.' WHERE lngcdlog =
> > $lngCDLog");
> >
> > /*** Here some content related to our script
> > */
> > $fError = fopen("/tmp/errorlog", "a+");
> > fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> > \n\n");
> > fclose($fError);
> >
> > /
> >
> **(9)**/
> > pg_exec($conn,"UPDATE tblcdlog SET blnsuccess = '1', strversion =
> > '$strVersion', strupdateno = '$strUpdateNo' WHERE lngcdlog =
> > $lngCDLog");
> >
> > }
> >
> >
> >
> > Please help me out Thanks in Advance..!
> >
> >
> >
> > Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
> >
> > You received this mess

Re: edit last row in the table.

2010-05-13 Thread Mateo San Román
If you are using a UUID, you should also have a timestamp field to
sort the table on that field...


On 11 mayo, 22:58, Jeremy Burns  wrote:
> Just being picky - you don't need limit => 1 if you are doing a find first.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 11 May 2010, at 23:33, Stefano Martins wrote:
>
>
>
>
>
> > This should do the trick:
>
> > public function bla()
> > {
> >    $lastPost = $this->Post->find('first', array('order' =>
> > array('Post.id DESC'), 'limit' => '1'));
> > }
>
> > Cya!
>
> > On 11 maio, 09:42, Andrei Mita  wrote:
> >> Do you want to edit the last row or the last inserted row?
>
> >> On Tue, May 11, 2010 at 3:00 PM, Jeremy Burns  wrote:
> >>> Do a find first sorted by id desc, then do a straightforward edit.
>
> >>> Something like should get the last row:
>
> >>> $row = $this->Model->find(
> >>>        'first',
> >>>        array(
> >>>                'order' => array('Model.id DESC')
> >>>                'recursive' => -1
> >>>        )
> >>> );
>
> >>> Jeremy Burns
> >>> jeremybu...@me.com
> >>> On 11 May 2010, at 12:52, Master Ram wrote:
>
>  hi.. all i want edit last row in the table how to do. if possible
>  send a sample code..
>
>  thank
>
>  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> >>> others with their CakePHP related questions.
>
>  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   om>For more options, visit this group at
> >>>http://groups.google.com/group/cake-php?hl=en
>
> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> >>> with their CakePHP related questions.
>
> >>> 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 >>>  om>For more options, visit this group at
> >>>http://groups.google.com/group/cake-php?hl=en
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> >> with their CakePHP related questions.
>
> >> 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 
> >> athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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 write update query in cakephp

2010-05-13 Thread Mateo San Román
Something like this:
On 'Tblcdlogs' Controller:

function Update($id) {

$this->Tblcdlog->id = $lngCDLog;
$this->set('strerrordesc' => 'The CD could not be mounted. Make sure
it is a valid $COMPANY_NAME Data CD.');
$this->save();

...
}

Please check the manual for further explanation

On 13 mayo, 05:00, Narendra Padala  wrote:
> Hi...All!,
>
> I am new to cake php,I am suing postgreSql i need to update some
> fields in my database. In my controller my code like thishere i
> need convert these update command to cake, Please anyone can help me
> out how to convert this in to cake.
>
> function fun() {
>
> /**
> ( 1 )**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not be
> mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
> lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> (2) 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(3)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(4)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD is not a
> valid $COMPANY_NAME data CD.' WHERE lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(5)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD may not be
> loaded in this $DEST_NAME.' WHERE lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(6)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strcdno = '$identifiercode' WHERE
> lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(7)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'Invalid
> $COMPANY_NAME CD-Rom ID Code.' WHERE lngcdlog = $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(8)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD has already
> been loaded, and may not be loaded again.' WHERE lngcdlog =
> $lngCDLog");
>
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
>
> /
> **(9)** 
> /
> pg_exec($conn,"UPDATE tblcdlog SET blnsuccess = '1', strversion =
> '$strVersion', strupdateno = '$strUpdateNo' WHERE lngcdlog =
> $lngCDLog");
>
> }
>
> Please help me out Thanks in Advance..!
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.g

Re: how write update query in cakephp

2010-05-13 Thread Jeremy Burns
Have you even looked at the online guide? 
http://book.cakephp.org/view/1031/Saving-Your-Data

Jeremy Burns
jeremybu...@me.com


On 13 May 2010, at 11:00, Narendra Padala wrote:

> 
> Hi...All!,
> 
> I am new to cake php,I am suing postgreSql i need to update some
> fields in my database. In my controller my code like thishere i
> need convert these update command to cake, Please anyone can help me
> out how to convert this in to cake.
> 
> 
> function fun() {
> 
> /**
> ( 1 )**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not be
> mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
> lngcdlog = $lngCDLog");
> 
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> (2)/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(3)**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
> sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(4)**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD is not a
> valid $COMPANY_NAME data CD.' WHERE lngcdlog = $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(5)**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD may not be
> loaded in this $DEST_NAME.' WHERE lngcdlog = $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(6)**/
> pg_exec($conn,"UPDATE tblcdlog SET strcdno = '$identifiercode' WHERE
> lngcdlog = $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(7)**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'Invalid
> $COMPANY_NAME CD-Rom ID Code.' WHERE lngcdlog = $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(8)**/
> pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD has already
> been loaded, and may not be loaded again.' WHERE lngcdlog =
> $lngCDLog");
> 
> /*** Here some content related to our script
> */
> $fError = fopen("/tmp/errorlog", "a+");
> fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
> \n\n");
> fclose($fError);
> 
> /
> **(9)**/
> pg_exec($conn,"UPDATE tblcdlog SET blnsuccess = '1', strversion =
> '$strVersion', strupdateno = '$strUpdateNo' WHERE lngcdlog =
> $lngCDLog");
> 
> }
> 
> 
> 
> Please help me out Thanks in Advance..!
> 
> 
> 
> 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 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions

how write update query in cakephp

2010-05-13 Thread Narendra Padala

Hi...All!,

I am new to cake php,I am suing postgreSql i need to update some
fields in my database. In my controller my code like thishere i
need convert these update command to cake, Please anyone can help me
out how to convert this in to cake.


function fun() {

/**
( 1 )**/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD could not be
mounted. Make sure it is a valid $COMPANY_NAME Data CD.' WHERE
lngcdlog = $lngCDLog");


/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
(2)/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(3)**/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'There is not
sufficient space on your hard drive.' WHERE lngcdlog = $lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(4)**/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD is not a
valid $COMPANY_NAME data CD.' WHERE lngcdlog = $lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(5)**/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD may not be
loaded in this $DEST_NAME.' WHERE lngcdlog = $lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(6)**/
pg_exec($conn,"UPDATE tblcdlog SET strcdno = '$identifiercode' WHERE
lngcdlog = $lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(7)**/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'Invalid
$COMPANY_NAME CD-Rom ID Code.' WHERE lngcdlog = $lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(8)**/
pg_exec($conn,"UPDATE tblcdlog SET strerrordesc = 'The CD has already
been loaded, and may not be loaded again.' WHERE lngcdlog =
$lngCDLog");

/*** Here some content related to our script
*/
$fError = fopen("/tmp/errorlog", "a+");
fwrite($fError, "ERROR : The CD may not be loaded in this $DEST_NAME...
\n\n");
fclose($fError);

/
**(9)**/
pg_exec($conn,"UPDATE tblcdlog SET blnsuccess = '1', strversion =
'$strVersion', strupdateno = '$strUpdateNo' WHERE lngcdlog =
$lngCDLog");

}



Please help me out Thanks in Advance..!



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 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: sql error 1054 unknown column in 'on clause'

2010-05-13 Thread Ambika Kulkarni
 U r the MASTER sir

Thanks to you, for all your kind help


On Thu, May 13, 2010 at 12:17 PM, Amit Rawat  wrote:

> No acknowledgement for me?
>
> 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 post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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


Routing GET parameters

2010-05-13 Thread Mateo San Román
Hello,

I'm using a cake view to serve an AJAX autocomplete which is
implemented in the form
URL?q=[searchstring]. I cannot change that implementation and I need
the URL to be in pretty form, since results are meant to be cached. Is
there a way I could route /controller/search/?=:string to /controller/
search/string???

The easiest way is to create a dummy action to look for get params and
call the real search action, but I find it ugly.

Thanks in advance

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 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 store drop down selected element in the table

2010-05-13 Thread Master Ram
think u sir..

On May 13, 1:04 pm, Jeremy Burns  wrote:
> > What do you get when you debug $this->data just before you do the save?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 13 May 2010, at 09:03, Master Ram wrote:
>
>
>
> > sir its storing only "0" i has to change something like 1 or 2 or 3
> > etc.
>
> > its not giving any error sir
>
> > On May 13, 12:54 pm, Jeremy Burns  wrote:
> >> I think your model name should be Agency, for a start.
>
> >> You haven't specified what error you are getting. What do you get when you 
> >> debug $this->data just before you do the save?
>
> >> Jeremy Burns
> >> jeremybu...@me.com
>
> >> On 13 May 2010, at 08:48, Master Ram wrote:
>
> >>> Hi... all
>
> >>> i am getting "agencies" table  field in to drop down. but i am not
> >>> able to store the selected item in to the "promoters" table ".
>
> >>> this is the code i user.
>
> >>> My table name is: "promoters" the fields are promoter_id,
> >>> agency_id.etc.,
>
> >>> this is my view code:
>
> >>>  >>>                 e($form->select('agencyId',
>
> >>>                               array(
> >>>                               'empty' => '-All Suppliers-',
> >>>                               $agencies),
> >>>                               null,
> >>>                               array(
> >>>                               'id' => 'agency_id',
> >>>                               'style' => 'width: 50%'),false));
> >>>                 ?>
>
> >>> this is my controller code:
>
> >>> function promoter(){
>
> >>>      $agencies = $this->Agencie->find('list',
> >>>                                           array(
> >>>                                           'fields' =>
> >>> array('agency_id','name'),
> >>>                                                            'order' =>
> >>>                                                            array(
>
> >>>                                                                'name
> >>> ASC')));
>
> >>>        $this->set('agencies',$agencies);
>
> >>>        if (!empty($this->data)) {
>
> >>>            $this->Promoter->create();
>
> >>>            $this->Promoter->save($this->data);
>
> >>>            $this->Session->setFlash('The User has been registered,
> >>> please login');
>
> >>>            $this->redirect(array('action'=>'promoters_step_two'));
>
> >>>        }
>
> >>>    }
>
> >>> where i did the mistake Please help me
>
> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> >>> with their CakePHP related questions.
>
> >>> 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 
> >>> athttp://groups.google.com/group/cake-php?hl=en
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> >> with their CakePHP related questions.
>
> >> 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 
> >> athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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 store drop down selected element in the table

2010-05-13 Thread Jeremy Burns
> What do you get when you debug $this->data just before you do the save?

Jeremy Burns
jeremybu...@me.com


On 13 May 2010, at 09:03, Master Ram wrote:

> sir its storing only "0" i has to change something like 1 or 2 or 3
> etc.
> 
> its not giving any error sir
> 
> On May 13, 12:54 pm, Jeremy Burns  wrote:
>> I think your model name should be Agency, for a start.
>> 
>> You haven't specified what error you are getting. What do you get when you 
>> debug $this->data just before you do the save?
>> 
>> Jeremy Burns
>> jeremybu...@me.com
>> 
>> On 13 May 2010, at 08:48, Master Ram wrote:
>> 
>> 
>> 
>>> Hi... all
>> 
>>> i am getting "agencies" table  field in to drop down. but i am not
>>> able to store the selected item in to the "promoters" table ".
>> 
>>> this is the code i user.
>> 
>>> My table name is: "promoters" the fields are promoter_id,
>>> agency_id.etc.,
>> 
>>> this is my view code:
>> 
>>> >> e($form->select('agencyId',
>> 
>>>   array(
>>>   'empty' => '-All Suppliers-',
>>>   $agencies),
>>>   null,
>>>   array(
>>>   'id' => 'agency_id',
>>>   'style' => 'width: 50%'),false));
>>> ?>
>> 
>>> this is my controller code:
>> 
>>> function promoter(){
>> 
>>>  $agencies = $this->Agencie->find('list',
>>>   array(
>>>   'fields' =>
>>> array('agency_id','name'),
>>>'order' =>
>>>array(
>> 
>>>'name
>>> ASC')));
>> 
>>>$this->set('agencies',$agencies);
>> 
>>>if (!empty($this->data)) {
>> 
>>>$this->Promoter->create();
>> 
>>>$this->Promoter->save($this->data);
>> 
>>>$this->Session->setFlash('The User has been registered,
>>> please login');
>> 
>>>$this->redirect(array('action'=>'promoters_step_two'));
>> 
>>>}
>> 
>>>}
>> 
>>> where i did the mistake Please help me
>> 
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
>>> with their CakePHP related questions.
>> 
>>> 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 
>>> athttp://groups.google.com/group/cake-php?hl=en
>> 
>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
>> with their CakePHP related questions.
>> 
>> 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 
>> athttp://groups.google.com/group/cake-php?hl=en
> 
> 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 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

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 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 store drop down selected element in the table

2010-05-13 Thread Master Ram
sir its storing only "0" i has to change something like 1 or 2 or 3
etc.

its not giving any error sir

On May 13, 12:54 pm, Jeremy Burns  wrote:
> I think your model name should be Agency, for a start.
>
> You haven't specified what error you are getting. What do you get when you 
> debug $this->data just before you do the save?
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 13 May 2010, at 08:48, Master Ram wrote:
>
>
>
> > Hi... all
>
> > i am getting "agencies" table  field in to drop down. but i am not
> > able to store the selected item in to the "promoters" table ".
>
> > this is the code i user.
>
> > My table name is: "promoters" the fields are promoter_id,
> > agency_id.etc.,
>
> > this is my view code:
>
> >  >                 e($form->select('agencyId',
>
> >                               array(
> >                               'empty' => '-All Suppliers-',
> >                               $agencies),
> >                               null,
> >                               array(
> >                               'id' => 'agency_id',
> >                               'style' => 'width: 50%'),false));
> >                 ?>
>
> > this is my controller code:
>
> > function promoter(){
>
> >      $agencies = $this->Agencie->find('list',
> >                                           array(
> >                                           'fields' =>
> > array('agency_id','name'),
> >                                                            'order' =>
> >                                                            array(
>
> >                                                                'name
> > ASC')));
>
> >        $this->set('agencies',$agencies);
>
> >        if (!empty($this->data)) {
>
> >            $this->Promoter->create();
>
> >            $this->Promoter->save($this->data);
>
> >            $this->Session->setFlash('The User has been registered,
> > please login');
>
> >            $this->redirect(array('action'=>'promoters_step_two'));
>
> >        }
>
> >    }
>
> > where i did the mistake Please help me
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

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 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 store drop down selected element in the table

2010-05-13 Thread Jeremy Burns
I think your model name should be Agency, for a start.

You haven't specified what error you are getting. What do you get when you 
debug $this->data just before you do the save?

Jeremy Burns
jeremybu...@me.com


On 13 May 2010, at 08:48, Master Ram wrote:

> Hi... all
> 
> i am getting "agencies" table  field in to drop down. but i am not
> able to store the selected item in to the "promoters" table ".
> 
> this is the code i user.
> 
> My table name is: "promoters" the fields are promoter_id,
> agency_id.etc.,
> 
> this is my view code:
> 
>  e($form->select('agencyId',
> 
>   array(
>   'empty' => '-All Suppliers-',
>   $agencies),
>   null,
>   array(
>   'id' => 'agency_id',
>   'style' => 'width: 50%'),false));
> ?>
> 
> 
> this is my controller code:
> 
> function promoter(){
> 
>  $agencies = $this->Agencie->find('list',
>   array(
>   'fields' =>
> array('agency_id','name'),
>'order' =>
>array(
> 
>'name
> ASC')));
> 
>$this->set('agencies',$agencies);
> 
>if (!empty($this->data)) {
> 
>$this->Promoter->create();
> 
>$this->Promoter->save($this->data);
> 
>$this->Session->setFlash('The User has been registered,
> please login');
> 
>$this->redirect(array('action'=>'promoters_step_two'));
> 
>}
> 
>}
> 
> where i did the mistake Please help me
> 
> 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 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

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 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: Limitations to plugins for app modularity - are there any left in cake 1.3?

2010-05-13 Thread keymaster

Jamie - yes, it does feel good to know someone else is doing things
the way you did. I'm sure others are too.

AD7six - You said:

> what do you do when in app project you don't want something you're inheriting?

You 404 all actions you don't want to inherit.
AppController::Return404(  array( ... controller/action pairs you
don't want  ...)  );


> if your base/core functionality is behavior based you don't include the 
> behavior that does "" and you're done.

All you're doing is turning the function calls in your afterSave()
into a list of behaviors in an $actsAs. In the first case one copies
the afterSave() into app/ and removes the notification call. In your
case, you copy the $actsAs from the base and remove the notifcation
behavior from the list.

Both cases involve copying some code, which may change in base, and
thus need to be propagated to app/. If the ordering of how the base
fires off it's behaviors needs to change, for example, you would have
to also change your $actsAs to reflect the new ordering.

If you are saying to not have any base models at all, just behaviors,
then you are right, there would be no code copying at all, just don't
include the notification behavior. But, that adds more work to develop
a client app, as you need to create all the models and $actsAs lists.

You've raised some interesting points, AD7Six.

You seem to be advocating a base comprised almost exclusively of
behaviors/components, with a minimum of controllers/models, so that
things can be assembled in the most flexible way for the client. The
inclusion of controllers/models, as you say, adds "rigidity" to the
base, making it less flexible.

I can see that in some cases.

In other cases though, many other cases, functionality literally can
remain unchanged across many client apps, so the "rigidity" of having
prepackaged controllers/models becomes an asset, not a liability, as
it's ready to go with almost no additional work. You gain in time
savings what you lose in flexibility.

I guess the real trick is knowing (if anyone can really know) what can
be deployed as is, and what will need to be recombined in different
ways before deployment.

AD7Six, how much of a behavior/component purist were you when you
developed your MIBase? Did you include any controllers/models, or is
it composed exclusively of behaviors/components?

Thanks for this enjoyable discussion.

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 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


how to store drop down selected element in the table

2010-05-13 Thread Master Ram
Hi... all

i am getting "agencies" table  field in to drop down. but i am not
able to store the selected item in to the "promoters" table ".

this is the code i user.

My table name is: "promoters" the fields are promoter_id,
agency_id.etc.,

this is my view code:

select('agencyId',

   array(
   'empty' => '-All Suppliers-',
   $agencies),
   null,
   array(
   'id' => 'agency_id',
   'style' => 'width: 50%'),false));
 ?>


this is my controller code:

function promoter(){

  $agencies = $this->Agencie->find('list',
   array(
   'fields' =>
array('agency_id','name'),
'order' =>
array(

'name
ASC')));

$this->set('agencies',$agencies);

if (!empty($this->data)) {

$this->Promoter->create();

$this->Promoter->save($this->data);

$this->Session->setFlash('The User has been registered,
please login');

$this->redirect(array('action'=>'promoters_step_two'));

}

}

where i did the mistake Please help me

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 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: Dealing with forms!!!!!

2010-05-13 Thread sherzo

Hi Paul

Thanks for your reply and the great comment about the validation. My main
issue is, the registration form is included in a light box and after
submission I dont like it to be redirected to another page in case of any
error especially of user turned off the javascript in the browser !

Thanks
Sherry


WebbedIT wrote:
> 
> Hmm, your doing all of your validation manually in the controller ...
> this is supposed to be done automagically by the model when you save
> the record.
> 
> Read the following through a couple of times:
> 
> http://book.cakephp.org/view/125/Data-Validation
> 
> The one thing you have to watch out for is the password field which is
> automatically hashed by the Auth component, so to check if
> password_confirm matches password you also need to hash the
> password_confirm field.  It's easy to do this using a custom
> validation function such as
> 
> User Model:
> ...
> var $validate = array(
>   'username' => array(
> 'isUnique' => array(
>   'rule' => 'isUnique',
>   'message' => 'Sorry, this username has been taken, please try
> another',
>   'last' => true
> ),
> 'validChars' => array(
>   'rule' => '/^[a-z0-9_]{1,}$/i',
>   'message' => 'Can only include letters, numbers and underscores'
> )
>   ),
>   'password_confirm' => array(
> 'notEmpty' => array(
>   'rule' => array('notEmpty'),
>   'message' => 'This field cannot be left blank',
>   'on' => 'create',
>   'last' => true
> ),
> 'confirm' => array(
>   'rule' => array('validateConfirmPassword'),
>   'message' => 'Password confirmation does not match'
> )
>   )
> );
> 
> function __validateConfirmPassword($field) {
>   $valid = false;
>   if ($this->data['User']['password'] ==
> Security::hash(Configure::read('Security.salt') .
> $field['password_confirm'])) {
> $valid = true;
>   }
>   return $valid;
> }
> ...
> 
> HTH
> 
> Paul.
> 
> 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 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Dealing-with-forms%21%21%21%21%21-tp28541795p28544666.html
Sent from the CakePHP mailing list archive at Nabble.com.

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 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: Containable Aggregate Fields Problem

2010-05-13 Thread WebbedIT
I have not done any work within Cake using GROUP BY, AVG or SUM etc
yet but immediately it strikes me that your running this query on the
wrong model and not GROUPing your results to allow it to return any
meaningful AVGs.

If you set debug to 2 and look at the queries being generated you will
see that for your above query it will run one query to find all songs
and then a query for each Song found to fetch its hasMany Ratings.

In theory this could work I suppose, but it's obviously not and I
would be looking to streamline the amount of queries generated anyway
by running the query on the ratings table with AVG(Rating.value) GROUP
BY Rating.song_id.  If you contained Song you would get all your data
but with just one generated query.

To further streamline this though I would calculate the average using
afterSave() and afterDelete() within your Rating model and save it in
Song as you could then easily sort your song's by rating.

HTH

Paul

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 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: Dealing with forms!!!!!

2010-05-13 Thread WebbedIT
Hmm, your doing all of your validation manually in the controller ...
this is supposed to be done automagically by the model when you save
the record.

Read the following through a couple of times:

http://book.cakephp.org/view/125/Data-Validation

The one thing you have to watch out for is the password field which is
automatically hashed by the Auth component, so to check if
password_confirm matches password you also need to hash the
password_confirm field.  It's easy to do this using a custom
validation function such as

User Model:
...
var $validate = array(
  'username' => array(
'isUnique' => array(
  'rule' => 'isUnique',
  'message' => 'Sorry, this username has been taken, please try
another',
  'last' => true
),
'validChars' => array(
  'rule' => '/^[a-z0-9_]{1,}$/i',
  'message' => 'Can only include letters, numbers and underscores'
)
  ),
  'password_confirm' => array(
'notEmpty' => array(
  'rule' => array('notEmpty'),
  'message' => 'This field cannot be left blank',
  'on' => 'create',
  'last' => true
),
'confirm' => array(
  'rule' => array('validateConfirmPassword'),
  'message' => 'Password confirmation does not match'
)
  )
);

function __validateConfirmPassword($field) {
  $valid = false;
  if ($this->data['User']['password'] ==
Security::hash(Configure::read('Security.salt') .
$field['password_confirm'])) {
$valid = true;
  }
  return $valid;
}
...

HTH

Paul.

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 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