[eluser]Rahul gamit[/eluser]
Hello,
I am trying to edit my records using the storedprocedure of mysql.
The problem is that , when i am tracing the lastquery which has been called very last using $this->db->last_query() it gives the called storedprocedure with parameters but it wont able to update any records in database.
here is my code
My StoredProcedure
Code:
CREATE DEFINER=`root`@`localhost` PROCEDURE `tblaccountmaster_edit`(
IN p_account_id int,
IN p_company_name VARCHAR(250),
IN p_first_name VARCHAR(250),
IN p_last_name VARCHAR(250),
IN p_billing_address VARCHAR(500),
IN p_city VARCHAR(100),
IN p_state VARCHAR(100),
IN p_country_id INT,
IN p_postal_code VARCHAR(10),
IN p_mobile_no VARCHAR(20),
IN p_primary_phone_no VARCHAR(30),
IN p_secondary_phone_no VARCHAR(30),
IN p_fax_no VARCHAR(30),
IN p_email VARCHAR(50)
)
BEGIN
UPDATE tblaccountmaster
SET
company_name = p_company_name,
first_name = p_first_name,
last_name = p_last_name,
billing_address = p_billing_address,
city = p_city,
state = p_state,
country_id = p_country_id,
postal_code = p_postal_code,
mobile_no = p_mobile_no,
primary_phone_no = p_primary_phone_no,
secondary_phone_no = p_secondary_phone_no,
fax_no = p_fax_no,
email = p_email
WHERE account_id = p_account_id;
select last_insert_id() as account_id;
END
and this is how i am calling this storedprocedure
Code:
$query= "CALL tblaccountmaster_edit(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$result = $this->db->query($query,array(
$id,
$this->company_name,
$this->first_name,
$this->last_name,
$this->billing_address,
$this->city,
$this->state,
'1',
$this->postal_code,
$this->mobile_no,
$this->primary_phone_no,
$this->secondary_phone_no,
$this->fax_no,
$this->email));
$str = $this->db->last_query();
echo $str;
i am using $this->db->last_query() so it will gives me the query which has been lastly called like this
Code:
CALL tblaccountmaster_edit('19','test infotech','test first name','test last name','surat','surat','gujarat','1','394210','979797979','1321321','123','265629','[email protected]')
and when i am executing this procedure in my client db tool it gives me the correct result, but when i am calling from codeigniter it won't work..
thanks in advance