Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] can't save transaction without details
#21

[eluser]theprodigy[/eluser]
Quote:<b>Fatal error</b>: Call to a member function getDetails() on a non-object in <b>C:\xampp\htdocs\comunion\system\application\modules\sec_users\controllers\sec_users.php</b> on line <b>538</b><br />

I think we just found part of your problem.

I'm assuming:
Code:
$sec_exist = $this->Sec_users_db->getDetails($dt);
is on line 538?

Did you load that model? If you did, check case sensitivity (sec_users_db instead of Sec_users_db)
#22

[eluser]maria clara[/eluser]
yes ,
Code:
$sec_exist = $this->Sec_users_db->getDetails($dt);
is on line 538.


i have this:

Code:
$this->load->model('Users_db','User');

so i did this:

Code:
$sec_exist = $this->User->getDetails($dt);

and my console show me this:

Quote:Array
(
[company_code] => hdh
[company_name] => hdfh
[id] => _empty
[oper] => add
)
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\comunion\system\application\modules\sec_users\controllers\sec_users.php:473)</p>
<p>Filename: codeigniter/Common.php</p>
<p>Line Number: 360</p>
#23

[eluser]maria clara[/eluser]
and this:

Quote:<h1>A Database Error Occurred</h1>
<p>Error Number: 1054</p><p>Unknown column 'company_code' in 'where clause'</p><p>SELECT `erp_sec_users`.*, `erp_c`.`dept_code`, `erp_c`.`dept_desc`, `erp_d`.`role_code`, `erp_d`.`role_desc`
FROM (`erp_sec_users`)
LEFT JOIN `erp_maint_department` erp_c ON `erp_sec_users`.`dept_id`=`erp_c`.`dept_id`
LEFT JOIN `erp_sec_role` erp_d ON `erp_sec_users`.`role_id`=`erp_d`.`role_id`
WHERE `company_code` = 'hdh'</p> </div>
&lt;/body&gt;
#24

[eluser]theprodigy[/eluser]
ok, so now delete the print_r($_POST) line (that was just for debugging, but it is throwing off modifying of headers)
#25

[eluser]theprodigy[/eluser]
attach a table name (or alias) to your where clause column.
Instead of
WHERE `company_code` = ‘hdh’
set it to be
WHERE `erp_sec_users`.`company_code` = ‘hdh’
(or whatever table it is that contains that column)
#26

[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1265370505"]attach a table name (or alias) to your where clause column.
Instead of
WHERE `company_code` = ‘hdh’
set it to be
WHERE `erp_sec_users`.`company_code` = ‘hdh’
(or whatever table it is that contains that column)[/quote]

its because the company_code is to be save to Maint_company table...not in sec_users table... i think i have a wrong table...

what do you think??
#27

[eluser]theprodigy[/eluser]
well, right now you don't have any table assigned to it, and if it's supposed to be saved to maint_company table, then you might need to join that table in with your query as right now you don't have that table listed to pull data from.

And, this is a SELECT query, not an INSERT query. If the data in company_code is supposed to be SAVED into the database, then you might need to change the type of query you are executing.
#28

[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1265370837"]well, right now you don't have any table assigned to it, and if it's supposed to be saved to maint_company table, then you might need to join that table in with your query as right now you don't have that table listed to pull data from.

And, this is a SELECT query, not an INSERT query. If the data in company_code is supposed to be SAVED into the database, then you might need to change the type of query you are executing.[/quote]

i have that maint_company table. i have tried this:

Code:
case $crudConfig['create']:
                $c = "";
                $dt['company_code'] = $this->input->post('company_code');
            [b]    $sec_exist = $this->Main_company_db->getDetails($dt);[/b]
                
                if ($sec_exist)
                {
                    $c .= 'Company ID already exists.';
                    $data['action'] = 'exist';
                }
                else
                {
                $fields = array(
                        "company_code"
                        ,"company_name"
                        );
                
                foreach ($fields as $field)
                {if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);}

                $item = $this->input->post("item");        
                [b]$data['item'] = $this->Main_company_db->save($dt,$item);[/b]
                }
                break;

but there's no image shown in my browser..
#29

[eluser]theprodigy[/eluser]
Quote:$data['item'] = $this->Main_company_db->save($dt,$item);
Is that supposed to be
Code:
$data['item'] = $this->Maint_company_db->save($dt,$item);

(with a 't' on Maint) ?
#30

[eluser]maria clara[/eluser]
i have tried this:

Code:
$data['item'] = $this->Maint_company_db->save($dt,$item);

and it shows my console this error:

Quote:A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message: Undefined property: Sec_users::$Maint_company_db</p>
<p>Filename: controllers/sec_users.php</p>
<p>Line Number: 536</p>

</div><br />
<b>Fatal error</b>: Call to a member function getDetails() on a non-object in <b>C:\xampp\htdocs\comunion\system\application\modules\sec_users\controllers\sec_users.php</b> on line <b>536</b><br />




Theme © iAndrew 2016 - Forum software by © MyBB