Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    Hatfield, England
    Posts
    855
    Member #
    9790
    I'm making an order system where users can move things up and down the page...

    Any ideas on how i can set up columns so that a new column would be more more than the last column?

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    If you have a auto increment column, plus another int type column, and when you create a new row (insert) you query the database for how many rows there are (COUNT).

    This value goes into your cat_order

  4. #3
    Senior Member
    Join Date
    Apr 2005
    Location
    Hatfield, England
    Posts
    855
    Member #
    9790
    Ha thats the solution i just come up with

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Do you mean the syntax for deleting, or do you mean how to keep your system in appropiate order?

    Lets say your table looked like
    Code:
       auto_inc   |   int_column  |   blah
       1                  1                   first row
       2                  2                   second row
       3                  3                   third row
    Then we execute this line
    delete from table where int_column = 2
    Our new table will look like:
    Code:
       auto_inc   |   int_column  |   blah
       1                  1                   first row
       3                  3                   third row
    And then if we add a row,
    insert into table values(4, 'fourth row')
    The output will be
    Code:
       auto_inc   |   int_column  |   blah
       1                  1                   first row
       3                  3                   third row
       4                  3                   fourth row
    I think if we get the number of records, and then increment it and insert that into the database, your int_column will have duplicates.

    So, delete using the primary key/auto inc column and all should be well, I believe.

    Yeah, delete using the primary key, and when inserting, get the number of rows + 1, that value is for your second int column.

    My dummy text in the blah column was throwing me off.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:05 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com