Sometimes you’ve got to think outside the box…

What do you do when all of a sudden you realise you forgot one little step during the setup of a script on your website a couple of days ago and now because of that something is not working on your new you-beaut website? To re-run the installation script would mean you’d lose everything you’ve done since install and starting all over from scratch. Where do you go from here?

Well I can tell you I all smiles now as I figured out what to do and solved the little problem, but that’s getting ahead of myself. My Number One piece of advice for you is DOUBLE CHECK that you’ve completed EVERY STEP of the setup before you run that installation file!!!

Anyway I was setting up a new site of mine (more about that when I launch) and I forgot to create a directory before I ran the install script. It turns out this in turn failed to setup some shtml files for the pre-installed articles, so you’d get 404 errors when you tried to view these articles.

The first part of my solution was to try and figure out what the code of these files looked like on the inside. So I created a new article which was added to the database and this also created the shtml file of which I was able to peak inside.

I found that it was just a single line of code that displayed an individual article. I then tried to duplicate this code for another article modifying the appropriate bit that referenced the other article and was satisfied to find that it worked just fine. Easy fix, right? Well yes and no. I discovered I needed to create 100-150 of these files!! Argggghhh!

It’d take hours to copy and paste each file, rename the file name and edit the code inside to reference the right article. I figured I needed to create 150 sequentially named files with sequentially update info inside each file. I had a bit of a search in google to find a program but didn’t come up with anything, so I thought I’d have to do it myself.

For all you techie programmers out there you’re all saying ‘a piece of pie’ I guess, but I didn’t have any compilers or the like as in the good ‘ol day at uni. I then remember I had WAMP installed and that I could run PHP locally on that. So I looked up the PHP manual online and went to figuring how to write a crude little php program to create all these files for me.

Long story short it was a success and I uploaded those file to the server and got my website articles working!! Yeah!!
So I was pretty pleased with myself and renewed my interest in learning more PHP.

Yep, so remember, make sure you read and complete ALL the steps before running any installation scripts :)

[carpwp:amazon{PHP, programming, database, website}][/carpwp]

VINTAGE SILVER PLATED RODD CAMILLE DESSERT SPOONS ORIGINAL BOX SET OF 6
US $71.96 (9 Bids)
End Date: Tuesday May-22-2012 2:39:08 PDT
Bid now | Add to watch list

MATCHBOX COLLECTIBLES DYG07-M 1948 TUCKER TORPEDO STUNNING COMES MINT BOXED
US $25.13 (4 Bids)
End Date: Tuesday May-22-2012 2:39:40 PDT
Bid now | Add to watch list

This entry was posted in General, Tips. Bookmark the permalink. Both comments and trackbacks are currently closed.