dcsimg
A Flash Developer Resource Site

Page 3 of 3 FirstFirst 123
Results 41 to 47 of 47

Thread: “Collect All” To Make Professional Mobile Application in Flash Lite 1.1 Enable Device

  1. #41
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Steps to Insert txt data into database:

    If you look at the countryCode.txt file, you can realize that to put this type of huge data into a database table is quite a tough time taking job if you do it manually. However, in this discussion I am going through steps where the PHP code will do this job in one click.

    Step 1:

    Place the text file into the www folder. Make sure that each line data holds the code then the sign and in last the name of the countries (example: countryCode:countryName). In PHP, this entire data will place in an array and each line will count one array number. The “:” sign is the separator of code and the name of the entire data.

    Step 2:

    To do the backend operation happen, we have to make a front-end html page from where we can put a database table name and call the php to run. I am going to give you a simple example to do this with a minimum need of an input text field and a create button in the html page.

    HTML Code:

    <html>
    <head>
    <title>:: EMI Application :: Create Table</title>
    </head>
    <body style="background:#E4E4E4; margin:auto;">
    <script Language="JavaScript">
    <!--
    function Validator(){
    if (createTable.name.value == ""){
    alert("Enter Table Name.");
    createTable.name.focus();
    return (false);
    }
    return (true);
    }
    -->
    </script>
    <div style="background:#990000; padding:5px 0px 10px 10px;">
    <form style="font-family:Arial, Helvetica, sans-serif; color:#999999;" name="createTable" method="POST" action="countryCode.php" onsubmit="return Validator()">Database Table Name:<br><input type="text"size="29"style="font-family:Arial, Helvetica, sans-serif;background:#FFFFCC;color:#996666;" maxLength="100" name="name">
    <input type="submit"style="font-family:Arial, Helvetica, sans-serif;font-size:12;" value="Create">
    </form>
    </div>
    <div style="padding:2px 10px 10px 10px;font-family:Arial, Helvetica, sans-serif;color:#999999;font-size:11;"><strong>"Collect All" to Make a Professional Mobile Application in Flash Lite 1.1 Enabled Devices. EMI Application.</strong> © - 2010-2011 <strong> MarlöPax.</strong> All rights reserved.</div>
    </body>
    </html>

    The above HTML code will display an input text field and a create button with a JavaScript text field validation and some CSS style decoration.

    Step 3:

    Make a new PHP file “creatTable.php” for this operation.


    continue... Step 3..........


    marlopax


    Subha Nabo Barsha (Bengali New Year 1417)


    Thursday, April 15, 2010
    Last edited by marlopax; 04-14-2010 at 03:14 PM.

  2. #42
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    1933 1st May, Happy Birthday Baba (DAD), Dedicate this post to his 76th birthday

    Create PHP code in “creatTable.php”

    Write the code below:


    PHP Code:
    <?PHP
     $host
    ="localhost";
     
    $user="root";
     
    $pass="";
     
    $database="db01sep2009mob_app";
     
    $conn=mysql_connect ($host$user$pass);
     
    mysql_select_db ($database);
     
    $tableName=$_POST["name"];
    $sql="CREATE TABLE $tableName
     (`countryCode`CHAR(2)NOT NULL,
     `countryName`VARCHAR(100)NOT NULL,
     PRIMARY KEY(`countryCode`)
     )"
    ;
    $query=mysql_query$sql$conn )or die("Database Exist");
    if(
    $query==1){
    echo 
    "Creating table:<strong> $tableName,</strong> Successfully.<br>";
     
    $open="countryCode.txt";
     
    $countries =file("$open");
     for(
    $i=0;$i<count($countries);$i){
     
    $tag=explode(':',$ countries[$i]);
      
    $i++;
      
    $queryTable=mysql_query("INSERT $tableName SET  countryCode= '$tag[0]',countryName='$tag[1]'");
    }
    }else{
    echo 
    $query;
    }
    ?>

    The above PHP codes connect the database, and then create a table getting the name from the html page. After that it opens the countryCode.txt file, and converts all the data into an array, and separates each array into two parts where the “:” sign is and insert the entire data into the table by looping it till it counts the total number of arrays.


    continue...


    marlopax


    Saturday, May 01, 2010

  3. #43
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    One Essential Tip:

    If your data contains [] sign, the database refuse to insert that data and drop that array.

    Example:

    CI:Cote D' Ivoire (Ivory Coast)

    The above data contains a inverted comma sign and MySQL refuse to insert this type of array so you should have to convert it by a [\] sign.

    Solution:

    CI:Cote D\' Ivoire (Ivory Coast)

    Well, if all had done in MySQL, we now see how php echo a list from this database, by which flash can show as a menu list.


    continue...


    marlopax


    Wednesday, May 12, 2010

  4. #44
    Member
    Join Date
    Nov 2000
    Location
    South East UK
    Posts
    91
    I thought it was a Blog!

  5. #45
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    Thanks derek

    Quote Originally Posted by derekcfoley View Post
    I thought it was a Blog!
    Thanks for your post and make this to a thread. What makes a blog I don't know but I only feel forum is to help others to develop with their needs. I posted here a series of methods on Flash Lite 1.1 associated with other languages, which I feel might be helpful to other developers who are into it.

    You might mean it as a "Blog", might because of, I am the only person who posted all without knowing whether it actually need or not. Its true, if you think in this direction, but if you search for such things, you must feel a good self discussion which contains many methods with explanations to buildup an applications or even at least give a start.

    But still I appreciate and respect your thoughts.

    With Regards

    MarlöPax
    Last edited by marlopax; 06-11-2010 at 10:01 AM.

  6. #46
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    marlopax.com

    www.marlopax.com is changing its Server. For a certain time you will not been able to access the file linked bellow:

    http://www.marlopax.com/countryCode/countryCode.txt

    Last date of download: 26th July 2010.

    If you need this file for your projects, or to test as per this discussion, please download it before 26th July 2010.

    Sorry for this inconvenience....

    Regards

    MarlöPax

    Note: You can leave your comment here, in this thread.

  7. #47
    Senior Member
    Join Date
    Jan 2011
    Posts
    171
    This thread is really helpful and I appreciate your efforts of all the lessons.

    I followed all of them. But why you not complete ?

    May be cause of getting time to give on it.

    But I request you please post the thing you planed to post it here.

    This will be really great and so kind of you.

    Thank You.

    Please



    arkitx

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center