when i am tried above like that, i got this error message
*Warning* (2) <javascript:void(0);>: pg_query() [function.pg-query
<http://php.net/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 <javascript:void(0);> | Context <javascript:void(0);>
$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) <javascript:void(0);>: *SQL Error:* ERROR: null value
in column "dtmcreated" violates not-null constraint
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *526*]
Code <javascript:void(0);> | Context <javascript:void(0);>
$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("<span style = \"color:Red;text-align:left\"><b>SQL
Error:</b> {$this->error}</span>", 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 <[email protected]>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
> <[email protected]>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 <[email protected]> wrote:
>>
>>> Have you even looked at the online guide?
>>> http://book.cakephp.org/view/1031/Saving-Your-Data
>>>
>>> Jeremy Burns
>>> [email protected]
>>>
>>>
>>> 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 this....here 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 [email protected]
>>> > To unsubscribe from this group, send email to
>>> > [email protected]<cake-php%[email protected]>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 [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]<cake-php%[email protected]>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 [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<cake-php%[email protected]>For
>> more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>
>
> --
> Dilip Godhani
> Jr Software Developer, Entourage Solutions
> e-mail: [email protected]
> [email protected]
> Web.: www.entouragesolutions.com
> m. 9913822582
>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en