Database row automically changed when i closed that table and reopened it!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asenthil
    New Member
    • Dec 2006
    • 61

    Database row automically changed when i closed that table and reopened it!

    Hai to all,

    i created a table in MYSql Database...

    And i have added 15 rows in it....

    like the following..

    asd,
    dff,
    dfds,
    hgh,
    ...
    ...
    ...
    ...

    aaa(15th row)

    when i saved that table, closed and reopened it,
    the last row(15th) ie the aaa row automatically
    changed to the 5th row...
    like the following...
    asd,
    dff,
    dfds,
    hgh,
    aaa,
    ...
    ...
    ...

    And the other rows are comes correctly in the order given by me...

    i think i want to change the database table properties to come correctly in
    the order given by me....

    Only the last row gives trouble to me...

    since i'm a beginner to mysql i dont know how to do that....

    Can any one tell me how to proceed for this?

    thanks
    senthil.
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by asenthil
    Hai to all,

    i created a table in MYSql Database...

    And i have added 15 rows in it....

    like the following..

    asd,
    dff,
    dfds,
    hgh,
    ...
    ...
    ...
    ...

    aaa(15th row)

    when i saved that table, closed and reopened it,
    the last row(15th) ie the aaa row automatically
    changed to the 5th row...
    like the following...
    asd,
    dff,
    dfds,
    hgh,
    aaa,
    ...
    ...
    ...

    And the other rows are comes correctly in the order given by me...

    i think i want to change the database table properties to come correctly in
    the order given by me....

    Only the last row gives trouble to me...

    since i'm a beginner to mysql i dont know how to do that....

    Can any one tell me how to proceed for this?

    thanks
    senthil.
    Please post the query that is giving you this behavior. Thanks.

    Comment

    • asenthil
      New Member
      • Dec 2006
      • 61

      #3
      Hai bartonc,

      thanks for ur reply.....

      [PHP]mysql_query(con n,"SELECT image FROM imagedb1"); [/PHP]

      this is query i have used.

      But that problem is not by query...

      i think itz just database properties problem...

      r u having any idea about this?

      thanks
      senthil

      Comment

      • sashi
        Recognized Expert Top Contributor
        • Jun 2006
        • 1749

        #4
        Originally posted by asenthil
        Hai bartonc,

        thanks for ur reply.....

        [PHP]mysql_query(con n,"SELECT image FROM imagedb1"); [/PHP]

        this is query i have used.

        But that problem is not by query...

        i think itz just database properties problem...

        r u having any idea about this?

        thanks
        senthil
        Hi there,

        What's the design layout of your table? Primary key? Identity column? Your SQL query seems to be fine, since it's return result set it means the syntax is just fine. I need more information on the table layout as it would ease in providing solution in return as well as to narrow down possibilities. Take care.

        Comment

        • asenthil
          New Member
          • Dec 2006
          • 61

          #5
          Hai shashi

          thanks for ur reply..

          my database is like this...

          Code:
          Name
          asd
          dff
          dfds
          hgh
          abc
          asadf
          asdf
          this is a simple database i had created. And then i had saved that
          database and closed...

          when i reopened that database the last row that is the 6th row(asdf) changes its
          location to the 5th row like the following...
          Code:
          Name
          asd
          dff
          dfds
          hgh
          abc
          asdf
          asadf
          Not for this table row.... when i tried to create lot of rows...
          saved, closed and when i reopened the table.... the last row
          automatically changes to the 5th row...

          i think the i want to check the table properties..

          But i dont know..

          do u know how to do that?

          thanks..
          senthil

          Comment

          • sashi
            Recognized Expert Top Contributor
            • Jun 2006
            • 1749

            #6
            Originally posted by asenthil
            Hai shashi

            thanks for ur reply..

            my database is like this...

            Code:
            Name
            asd
            dff
            dfds
            hgh
            abc
            asadf
            asdf
            this is a simple database i had created. And then i had saved that
            database and closed...

            when i reopened that database the last row that is the 6th row(asdf) changes its
            location to the 5th row like the following...
            Code:
            Name
            asd
            dff
            dfds
            hgh
            abc
            asdf
            asadf
            Not for this table row.... when i tried to create lot of rows...
            saved, closed and when i reopened the table.... the last row
            automatically changes to the 5th row...

            i think the i want to check the table properties..

            But i dont know..

            do u know how to do that?

            thanks..
            senthil
            Hi there,

            Just one field in your table? Name? No other fields?

            Comment

            • asenthil
              New Member
              • Dec 2006
              • 61

              #7
              ya only one field....

              first i'm trying for this simple database...
              tats y there is only one field

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                MySQL (and that goes for most db engines) never gave you any documented guarantee that the order in which you store your rows (or the order of the columns) is the order by which you retrieve them. The contrary, the whole point of SQL is to abstract the application from the data storage. You should always specify the order in which you wish to retrieve your data.

                Ronald :cool:

                Comment

                • sashi
                  Recognized Expert Top Contributor
                  • Jun 2006
                  • 1749

                  #9
                  Originally posted by asenthil
                  ya only one field....

                  first i'm trying for this simple database...
                  tats y there is only one field
                  Hi there,

                  Ronald's correct. You need to specify an order along with your query statement. Kindly refer to below sample query statement, hope it helps. Good luck & Take care.

                  Code:
                    SELECT * FROM [TableName] ORDER BY [FieldName] ASC;

                  Comment

                  • asenthil
                    New Member
                    • Dec 2006
                    • 61

                    #10
                    Hai Sashi,

                    thanks for ur reply....

                    ur conditions used for me....

                    i'm working in the field of C++...

                    Do u know how to convert text data to xml data?

                    is there any source codes available in the net?

                    will u plzz help me?

                    thanks..
                    senthil

                    Comment

                    • sashi
                      Recognized Expert Top Contributor
                      • Jun 2006
                      • 1749

                      #11
                      Originally posted by asenthil
                      Hai Sashi,

                      thanks for ur reply....

                      ur conditions used for me....

                      i'm working in the field of C++...

                      Do u know how to convert text data to xml data?

                      is there any source codes available in the net?

                      will u plzz help me?

                      thanks..
                      senthil
                      Hi there,

                      C++ and me are million miles apart, i would suggest you asking this question in C++ from section, hope it helps. Good luck & Take care.

                      Comment

                      • asenthil
                        New Member
                        • Dec 2006
                        • 61

                        #12
                        ya ok........

                        thanks for ur responses...

                        take care
                        bye
                        senthil

                        Comment

                        Working...