Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Location
    Texas, United States
    Posts
    131

    Random Data In MySQL Table

    Hi!,

    I'm not sure if this is possible or not, but let me explain what i'm trying to implement on my website "Written in PHP with MySQL". Ok! i'm designing a lead generation/mailing list business website, and need to know if it's possible to say, select data from the table that i configured the form to store the prospects info into, and randomly add leads to all my users based on the amount of lead they ordered. I have made the option of ordering lead packages of 10, 20, 30, 40. So would it be possible to make a php script to randomly take leads from that table and add them to the users accounts until their order is filled with the set amount of leads?.

    Thank you! In Advance.

  2. #2
    Join Date
    Sep 2002
    Location
    Illinois
    Posts
    2,304
    I will teach you how to do that by yourself ...

    select data from the table that i configured
    MYSQL SELECT STATEMENT >> http://www.mysql.com/doc/en/SELECT.html


    and randomly
    http://php.net/random
    http://www.mysql.com/doc/en/Mathematical_functions.html

    http://www.mysql.com/doc/en/Mathematical_functions.html
    MYSQL INSERT >> http://www.mysql.com/doc/en/INSERT.html
    MYSQL UPDATE >> http://www.mysql.com/doc/en/UPDATE.html

  3. #3
    Join Date
    Jan 2004
    Location
    Texas, United States
    Posts
    131
    Thanks! for the quick reply. Although it wasn't very helpful though, that link for the php function doesn't work anyhow. If you could write a sample php script for me that'd be great!.

    Thank you!

  4. #4
    Your first paragraph is a bit confusing, maybe if you were a bit more elaborate or perhaps gave us a specific example/story we can understand.

    Regards,
    Patrick

  5. #5
    Join Date
    May 2002
    Location
    UK
    Posts
    2,994
    Well in MySQL you can have an ORDER BY RAND() command in a Select statement. It's much more efficient to do those sorts of things in SQL than in PHP if you can.

  6. #6
    Join Date
    Jan 2004
    Location
    Texas, United States
    Posts
    131
    Hi! thank you! for the quick replys. Ok! let me explain in detail what i want this application to do!.

    1. Ok! i have my form data stored into a MySQL table, now i would like to beable to automatically (Hopefully Not Manually) select a random lead from that table, move that data into a clients lead data table - and then delete that lead from the form data table so i won't have a double copied lead.

    2. Ok! next thing, i want the database to be able to delete leads that are 30 days old in the clients database automatically.

    Hope that clear things up a bit.

    Thanks!

Posting Permissions

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