1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need simple MySQL job done!

Discussion in 'Hire a Freelancer' started by Ice Cube, Feb 13, 2012.

  1. Ice Cube

    Ice Cube Registered Member

    Joined:
    Aug 18, 2011
    Messages:
    57
    Likes Received:
    2
    hello i need a very simple MySQL job done i could even do it my self if someone tells me how.

    basicly i have a database full of info like this
    (1,878 rows to be exact)
    [​IMG]

    what i need is to take just the User & Pass fields from each line and put them in a .txt document in this format

    user: pass
    user: pass
    user: pass

    i am putting a space between : and pass only because when i put them togother it shows a smiley user:pass

    using the image above as an example my .txt file would need to look like this

    tikitime:brudda
    test:test
    google:sucks
    test:test
    username:password
    asasa:asasa
    test:test
    test:test
    lunar fish3:hillbilly67
     
    Last edited: Feb 13, 2012
  2. noermanto

    noermanto Regular Member

    Joined:
    Nov 18, 2009
    Messages:
    305
    Likes Received:
    288
    Occupation:
    None
    Location:
    # JKT #
    Home Page:
    Easy, just copy the database, remove un-necessary fields then export as excel then export as text and modify anything as you like. Detail later as necessary.
     
  3. skmetaly

    skmetaly Newbie

    Joined:
    Oct 24, 2009
    Messages:
    21
    Likes Received:
    1
    you can easily do this with PHP , or simply from phpmyadmin ( try the export feature , they have .txt export, and selected just some columns )

    Also , with php you will need to connect to the database , and execute a query
    " SELECT user , pass FROM yourTable " and take each row and use the file handler from php

    You can find easy find some mysql connect .

    here is a sample for php :

    <?php
    // Make a MySQL Connection
    mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
    mysql_select_db("test") or die(mysql_error());

    // Get all the data from the "example" table
    $result = mysql_query("SELECT user , pass FROM yourTable")
    or die(mysql_error());

    $myFile = "testFile.txt";
    $fh = fopen($myFile, 'w') or die("can't open file");


    // keeps getting the next row until there are no more to get
    while($row = mysql_fetch_array( $result )) {


    fwrite($fh, $row['user'].":".$row['pass']);
    }

    fclose($fh);
    ?>

    hope this is fine, i didn't tested it :)
     
  4. zelma143

    zelma143 Power Member

    Joined:
    Jun 25, 2010
    Messages:
    571
    Likes Received:
    37
    Occupation:
    PHP programmer,Bot maker,iMacro script maker
    you can even export from phpmyadmin specified filed and just replace some word with : sign

    if you want I can code into php

    Thanks