randomly run phone number and how to convert the result in .csv file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bb nicole
    New Member
    • Jan 2007
    • 127

    randomly run phone number and how to convert the result in .csv file?

    Hi.. i would like to create a page that provide users to randomly run phone number. I know it is use rand() to code it, but how if i porvide a box for user to key in how many phone number they want to key in?
    For example, the user type 1000, then there are 1000 phone number will randomly run and come out as output.. And how to convert the result/output in .csv file? Thank a lot..:)
  • Purple
    Recognized Expert Contributor
    • May 2007
    • 404

    #2
    Hi,

    It is easier to help if you get into more detail regarding the code and the issues you are having - how far have you got with this ? what are the problems stopping you from progressing ?

    Purple

    Comment

    • bb nicole
      New Member
      • Jan 2007
      • 127

      #3
      Hi.. sorry.. actually i don't have any idea how to code if user key in 100 in the textarea,then 100 phone number will randomly choose from database.. If user type 39, then 39 will be randomly choose from database.. i just know need 2 use rand() for randomly choose the number from web tutorial, but how to code when the user type the amount of phone number they want to randomly choose as output?
      Thanks..


      Originally posted by Purple
      Hi,

      It is easier to help if you get into more detail regarding the code and the issues you are having - how far have you got with this ? what are the problems stopping you from progressing ?

      Purple

      Comment

      • Purple
        Recognized Expert Contributor
        • May 2007
        • 404

        #4
        Hi,

        take the user input and and use within a loop where containing the rand() function to drive which record to read from the database - add the number returned from the database into an array and by the end of the loop you have an array populated with your results.

        there is an issue where you may randomly select the same phone number multiple times.. You could code around this by ensuring you don't already have the phone number within the array before you add it, getting another one if you do - if you take this approach make sure you dont try to get more phone numbers than you have on the database or you will end up in a loop and script timeout..

        Hows that ?

        Purple

        Comment

        • Anthony2oo5
          New Member
          • Jun 2007
          • 26

          #5
          Do you want the script to randomly create phone numbers or select phone numbers from a database.

          Comment

          Working...