Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8607709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:25:37+00:00 2026-06-12T03:25:37+00:00

I have problem in updating mysql table. While the problem seems somewhat strange I’m

  • 0

I have problem in updating mysql table. While the problem seems somewhat strange I’m explaining it below.

I am working on user’s profile update in which the data from single form is inserting/updating to two different tables but if i update the whole form information then updating data is successful but if i only update some 2 or 3 fields then updation is fail. I’m using mysql stored procedure for sql update the code is as under…

DELIMITER $$

DROP PROCEDURE IF EXISTS `usp_user_profile_save` $$
CREATE PROCEDURE `usp_user_profile_save`(IN sIntro_para VARCHAR(255), IN sBook VARCHAR(255), IN sProfileNewName VARCHAR(255),
IN iRel VARCHAR(255), IN iBdate VARCHAR(255), IN iSO INT, IN iMerital_status INT, IN iChildren INT, IN iProfession INT,
IN iIncome INT, IN iIncome_unit INT, IN iCountry INT, IN iState INT, IN iCity_or_post_code INT, IN iHeight VARCHAR(255), IN iSp INT, IN iEthnicity INT,
IN iHair_color INT, IN iHair_lenght INT, IN iEye_color INT, IN iSmoker_or_not INT, IN iUserId INT)
BEGIN
DECLARE n,n1,respCode INT;
DECLARE respMsg,dbg VARCHAR(255);

  START TRANSACTION;

  UPDATE `tbl_user` SET
    `introduction` = sIntro_para,
    `profile_picture` = sProfileNewName,
    `birthdate` = iBdate,
    `s_o` = iSO,
    `marital_status` = iMerital_status,
    `children` = iChildren,
    `profession` = iProfession,
    `income` = iIncome,
    `income_unit` = iIncome_unit,
    `my_book` = sBook,
    `r_s` = iRel,
    `counrty` = iCountry,
    `state` = iState,
    `city` = iCity_or_post_code,
    `modified` = NOW(),
    `modified_by` = iUserId
  WHERE `id` = iUserId;
  SET n = ROW_COUNT();

  IF n <= 0 THEN
    ROLLBACK;
  ELSE

    IF EXISTS (SELECT * FROM `tbl_user_physical` WHERE `tbl_user_id` = iUserId) THEN
      UPDATE `tbl_user_physical` SET
        `tbl_user_id` = iUserId,
        `height` = iHeight,
        `shape` = iSp,
        `ethnicity` = iEthnicity,
        `hair_color` = iHair_color,
        `hair_length` = iHair_lenght,
        `eye_color` = iEye_color,
        `smoker_or_non_smoker` = iSmoker_or_not
      WHERE `tbl_user_id` = iUserId;
      SET n1 = ROW_COUNT();

    ELSE
        INSERT INTO `tbl_user_physical`(`tbl_user_id`, `height`, `shape`, `ethnicity`, `hair_color`, `hair_length`, `eye_color`, `smoker_or_non_smoker`) VALUES (iUserId, iHeight, iSp, iEthnicity, iHair_color, iHair_lenght, iEye_color, iSmoker_or_not);
        SET n1 = LAST_INSERT_ID();
    END IF;

    IF n1 > 0 THEN
      COMMIT;
        SELECT 1 AS respCode, 'Registration successfull.' AS respMsg;
    ELSE
        ROLLBACK;
        SELECT 0 AS respCode,'Registration couldn\'t be completed.' AS respMsg, n, n1;
    END IF;
  END IF;

END $$

DELIMITER;

Though i have googled my question many time with different keywords but i dont find relevant questions as mine, I have written update statement correctly but its not updating because most of the new data which is going to be update is same as old and my senior said me that update only work if there is a new set of data is submitted and used..

so, please help me to solve this problem
thanks in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:25:39+00:00Added an answer on June 12, 2026 at 3:25 am

    I lately come to know that UPDATE statement return error if we update same data. So, I’ve update added new column modified_date and updating this field with NOW() so that at least one column got changed and UPDATE statement returns no error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem in updating date. My first table is DONOR donor-nic----username-----status
I have a problem updating MySQL rows using Jquery. This is my current code.
I am have some problem in updating my qotwVote1a table's Vote1a field through PHP.
I am having a problem updating several rows of a mysql table using a
I have a problem updating an MySQL Database. I want to be able to
Have a problem with updating an existing record of my DB. In my view
i have a problem with updating my textview. i am making a c2dm app.
I have problem while loading data into html select when users press or click
So I'm using PHP/MySQL and I have a tbl_profile table with the following fields:
I fixed the problem below by updating the Google maps API version in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.