Results 1 to 2 of 2

Thread: [newbye]How To Populate the Fields of the records In A MySQL Table With uniqueid()?

  1. #1
    Join Date
    Oct 2009
    Thanked 0 Times in 0 Posts

    Red face [newbye]How To Populate the Fields of the records In A MySQL Table With uniqueid()?

    Hello, I'm a newbye here and about PHP; be patient please :-)

    I have a mySQL table with 15000 rows; I need to populate a field of it (varchar(15)) - to be used in a way similar to a primary key - with the uniqid() PHP function. I do not want an autoincrement field type.

    The algorithm is:

    1 - positioning to the first row (record);
    2 - generating a value with the uniqid() function;
    3 - updating with it an empty field of that record;

    All of those three steps till to the end of of the table (all of the records).

    What is the PHP code to do all of that please?

    Thank you.


  2. #2
    Join Date
    Jan 2007
    Davenport, Iowa
    Thanked 97 Times in 95 Posts


    Sorry, i am being a little dense here, but could you post a short example of maybe 3 rows of what it is and another 3 rows, both examples with columns names, that show what you want it converted to?

    You say that you do not want to use autoincrement. why? If not then what would you like to use instead? It is your algorithm that I am having a bit of trouble following.
    To choose the lesser of two evils is still to choose evil. My personal site


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts