Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

I need to write my first script, where to start?

  • 07-04-2011 12:35PM
    #1
    Registered Users, Registered Users 2 Posts: 459 ✭✭


    I'm asking for some advice on where to start learning to code for web applications, what language should I begin with that best suits PHP and MySQL driven applications in a MS environment?

    I'd like to start by writing my first script and ask you guy's to help me as I go along:confused:

    I'll start by writing a script for an e-commerce website of which the bare-bones are up and running on Joomla/virtuemart on my IIS 7 webserver. I don't want to use 3rd party modules and want to hand code all that needs doing.

    The script needs to:
    • Access the vendors FTP
    • Download a CSV containing product info
    • Insert or replace "YOURIDHERE" (my afilliate ID) into a field on every row
    • Insert specific rows of the CSV into MySQL database (structure of original CSV and target database column's are different)

    :confused::confused::confused:

    I could just throw money at it...but that just plain ol' boring.

    Please help?


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    CSU wrote: »
    I'm asking for some advice on where to start learning to code for web applications, what language should I begin with that best suits PHP and MySQL driven applications in a MS environment?

    Well PHP is a language in itself, and MySQL has a query language, so those would be a good place to start given those requirements.


  • Registered Users, Registered Users 2 Posts: 220 ✭✭dueyfinster


    Python has a class with methods for dealing with CSV and how they are laid out. Worth checking out...


  • Registered Users, Registered Users 2 Posts: 23,202 ✭✭✭✭Tom Dunne


    CSU wrote: »
    The script needs to:
    • Access the vendors FTP
    • Download a CSV containing product info
    • Insert or replace "YOURIDHERE" (my afilliate ID) into a field on every row
    • Insert specific rows of the CSV into MySQL database (structure of original CSV and target database column's are different)

    The way I would approach it is as follows:

    Get the FTP part working by performing the steps by hand (i.e. at the command prompt). Once you get that working, put it into a script (FTP /? is a good start :))

    Then wrap a Windows batch file around it and schedule the batch file via Windows Scheduler so it runs every day/night/whenever.

    Once you have got your file, you can then perform the pre-processing via PHP prior to insertion into the database using SQL.

    I don't know enough about PHP to say whether you can FTP directly from the language, maybe you can.


  • Registered Users, Registered Users 2 Posts: 2,793 ✭✭✭oeb


    Tom Dunne wrote: »
    I don't know enough about PHP to say whether you can FTP directly from the language, maybe you can.

    There are a number of classes available to allow you to do this.
    http://code.google.com/p/ftp-php/
    http://www.phpclasses.org/package/3174-PHP-Client-to-access-FTP-servers-in-pure-PHP-code.html


    That being said, the last time I had to do something similar to this, I just wrote the retriever in perl.


Advertisement