I need some quick help with php code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hyper
    Confirmed User
    • Mar 2002
    • 5294

    #1

    I need some quick help with php code

    this is for a mainstream site of mine
    i could spend 3 weeks trying to figure this out.. but

    i need to select data from a mysql table by date then output it
    in a comma delimited txt file to download
    so i can upload it into paypal for my affiliates.

    can someone throw me some generic code
  • com
    Confirmed User
    • Aug 2003
    • 4541

    #2
    www.phpbuilder.com
    Or use the PEAR API or hire me for 5 minutes ;)

    Real. Professional. Hosting.
    .:Expect Nothing Less:.
    320-078-843 :: www.realprohosting.com :: [email protected]

    Comment

    • LuSiD
      Confirmed User
      • Dec 2002
      • 434

      #3
      Originally posted by hyper
      this is for a mainstream site of mine
      i could spend 3 weeks trying to figure this out.. but

      i need to select data from a mysql table by date then output it
      in a comma delimited txt file to download
      so i can upload it into paypal for my affiliates.

      can someone throw me some generic code
      Well, I might need some more details than that, but this is what I would do...

      <?php
      define("CONN", mysql_connect("localhost", "username", "password");
      mysql_select_db("my_db", CONN);

      $sql = sprintf("select * from my_table order by my_date");
      $result = mysql_query($sql, CONN);
      if (mysql_num_rows($result) > 0) {
      $str = "";
      $fp = fopen("/path/to/file.txt", "w");
      while ($row = mysql_fetch_array($result)) {
      fputs($fp, implode(',' $row) . "\n");
      }
      fclose($fp);
      }
      ?>
      Hope it helps. Need any more help, hit me up on ICQ. 132514337.
      I bought a dog the other day... I named him Stay. It's fun to call him... "Come here, Stay! Come here, Stay!" He went insane. Now he just ignores me and keeps typing.

      Comment

      • hyper
        Confirmed User
        • Mar 2002
        • 5294

        #4
        Lusid thanks alot.. i'll give it a whirl later on today

        Comment

        Working...