usin Join in the update query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    usin Join in the update query

    hi there i am making an application with the help of php html mysql and ajax.what i want to do is that i have two diffferent tables
    1.myrage_member s.
    2.myrage_member s_profile.

    i have made a page where the user could edit his/her profile which is then saved in these two different tables but i have no past experience to use joins in the update query as i am a newbee to php and mysql.
    can any body help or give me a link to any useful article that would help me in doing this so .
    any help in this regard would be highly appreciated.
    regards,
    Omer Aslam.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Look at the following tutorial about updating with joins at UPDATing with table Joins

    Ronald

    Comment

    • omerbutt
      Contributor
      • Nov 2006
      • 638

      #3
      Originally posted by ronverdonk
      Look at the following tutorial about updating with joins at UPDATing with table Joins

      Ronald
      thanks for the help Ron i check that immediately
      regards,
      omer.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Most welcome. See you around.

        Ronald

        Comment

        • omerbutt
          Contributor
          • Nov 2006
          • 638

          #5
          Originally posted by ronverdonk
          Most welcome. See you around.
          Ronald
          hi i read that article and got some idea about how to write it but i am still getting error in this query ,i know there is some thing that is missed by me but cant figure it out what?, here is my query
          [code=php]
          $sqlUMP="update myrage_members, myrage_members_ profile set
          myrage_members. member_firstnam e='$firstname',
          myrage_members. member_lastname ='$lastname',
          myrage_members. member_email='$ email',
          myrage_members. member_type='$m em_type',
          myrage_members_ profile.members _profile_countr y='$country',
          myrage_members_ profile.members _profile_city=' $city',
          myrage_members_ profile.members _profile_aim='$ memberaim',
          myrage_members_ profile.members _profile_aboutm e='$mem_aboutme ',
          myrage_members_ profile.memeber s_profile_age_s tatus='$age_sta tus',
          where myrage_members. member_id='$mem _id' and myrage_members_ profile.member_ id='$mem_id'";
          $rsUMP=mysql_qu er($sqlUMP)or die(mysql_error ().'<br />'.$sqlUMP);
          [/code]
          Last edited by ronverdonk; Mar 25 '08, 01:06 PM. Reason: code tags!!!

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            As a member for some time now, you know the following text and that you have to emclose code within tags. So adhere to the Posting Guidelines or we will have to restrict you in the use of this forum.

            moderator

            Please enclose your posted code in [code] tags (See How to Ask a Question).

            This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

            Please use [code] tags in future.

            MODERATOR

            Comment

            • omerbutt
              Contributor
              • Nov 2006
              • 638

              #7
              Originally posted by ronverdonk
              As a member for some time now, you know the following text and that you have to emclose code within tags. So adhere to the Posting Guidelines or we will have to restrict you in the use of this forum.

              moderator

              Please enclose your posted code in [code] tags (See How to Ask a Question).

              This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

              Please use [code] tags in future.

              MODERATOR
              sorryyyy [:(]
              regards,
              omer

              Comment

              • omerbutt
                Contributor
                • Nov 2006
                • 638

                #8
                Originally posted by ronverdonk
                As a member for some time now, you know the following text and that you have to emclose code within tags. So adhere to the Posting Guidelines or we will have to restrict you in the use of this forum.

                moderator

                Please enclose your posted code in [code] tags (See How to Ask a Question).

                This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

                Please use
                Code:
                 tags in future.
                
                MODERATOR
                Code:
                and i forgot to write the error code that i am getting here is the error 
                [code=error]
                You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where myrage_members_profile.member_id=1 and myrage_members.member_id=1' at line 11<br />update myrage_members,myrage_members_profile set 
                			myrage_members.member_firstname='omer',
                			myrage_members.member_lastname='aslam',
                			myrage_members.member_email='opstec_mohsin@hotmail.net',
                			myrage_members.member_type='Not telling',
                			myrage_members_profile.members_profile_country='Pakistan',
                			myrage_members_profile.members_profile_city='',
                			myrage_members_profile.members_profile_aim='',
                			myrage_members_profile.members_profile_aboutme='',
                			myrage_members_profile.members_profile_age_status='display',
                			where myrage_members_profile.member_id=1 and myrage_members.member_id=1

                Comment

                • ronverdonk
                  Recognized Expert Specialist
                  • Jul 2006
                  • 4259

                  #9
                  How about the comma at the end of line 10 right before the WHEN:
                  Code:
                  myrage_members_profile.members_profile_age_status=  'display',
                  that should not be there, because it expects another column name.

                  Ronald

                  Comment

                  Working...