Jump to content

Need a little Tutoring - How to turn and idea into script...


Andress

Recommended Posts

This is where I am getting stuck and I appreciate help with it, I understand what each basic PHP function does, and I can generally tell you what a script is doing but when I take an idea I have a hard time turning it into script. Let's take a classic example, how to make a cup of tea.

 

Get a water kettle

Fill the kettle with water

Turn on the stove to hi

Put kettle on the stove

Heat to boiling

Get a teacup

Put a teabag in the teacup

Pour boiling water over the teabag

Let steep for 5 minutes.

Remove and throw away teabag.

Add suger or creamer to taste in tea.

Done

 

So now how do I figure out what functions/events I need to make this work?

If anyone is willing to spend a little time with me via email so I can get over this frustrating hump I would really appreciate it.

 

Link to comment
Share on other sites

Making a cup of tea is not a classic example of how to use functions in PHP, let alone make any sense, at least to me...  If you want to learn, read a tutorial, that's what they're there for.  I'm not sure how many people are going to sit there for hours holding your hand through this.  You haven't even mentioned what you're trying to accomplish, sounds to me you want to learn the basics of PHP.  Have you even attempted to do this on your own?  We're willing to help but you have to show some kind of effort.

Link to comment
Share on other sites

Making a cup of tea is not a classic example of how to use functions in PHP, let alone make any sense, at least to me...  If you want to learn, read a tutorial, that's what they're there for.  I'm not sure how many people are going to sit there for hours holding your hand through this.  You haven't even mentioned what you're trying to accomplish, sounds to me you want to learn the basics of PHP.  Have you even attempted to do this on your own?  We're willing to help but you have to show some kind of effort.

I agree with this

 

Making a cup of tea is a step by step procedure. In terms of using PHP, it would simply be step1.php, step2.php, step3.php, step4.php, etc.

 

PHP runs on the server and returns HTML based on certain things.  If else statements, loops, arrays, etc. etc. etc. make PHP an interactive language.  Based on x, do y. Based on y, do z, etc.  It's not a step by step thing.

Link to comment
Share on other sites

The best place to start is with little stuff that you have already used or seen before and trying to duplicate it. That works best for me because I already have the idea in mind. After you decide what to code then you have to figure out how to go about coding it. Then I would get piece of paper out and write down what I need and the order in which I would need them. Then as you think you have it figured out start coding it. I guarantee once you start there will be things you forgot about or missed when you originally planned it out. But while you think about it right it down and remember to add it. The main thing I try to make sure I take care of is error handling. For example with a user registration. You do not want the user to be able to enter no password for their username. So you have to add in error handling. Hope that helps some.

Link to comment
Share on other sites

Thank you all for the advice, the tea example was just that an example. Ngreenwood6 I appreciate your comments that does help quite a bit and will help to put me on the right track.

 

As far as effort... well I have read a few books, taken some video courses but all of them just go over the functions etc. of PHP they do not have you apply that to any type of example. I do get stuck when I wish to write code from a plan I have wrote up. In any case when I get something going I'll post it up for suggestions and improvement.

 

Also, I can raw code HTML without a problem, taught myself quite awhile ago so I'm not ... hum how do I say this, expecting anyone to write my code.

 

As to what I'm doing, I want to improve on a script I have adding some new items to it. I do not wish to go into detail at this time of what this code is but again thank you for your responses.

Link to comment
Share on other sites

Myself, I begin with layout / data first.

Making a simple html form or outline helps a lot.

This will also help in u visualizing what data u will need.

Such as a registration forms, blog outlines.

with the data i need, i decide on how to store that data db/flatfile/outside source.

 

with just that, i begin coding, as the data gives a good direction to how to handle the data (input validation/error handling)

 

than finally the core processing code, whut the heck we do with all that data.

it may take some time, but giving yerself an outline of the finish product is a great way to start.

 

Anyways good luck

Link to comment
Share on other sites

As far as effort... well I have read a few books, taken some video courses but all of them just go over the functions etc. of PHP they do not have you apply that to any type of example.

 

That should be plenty of information.  PHP isn't exactly the most extensive language...  As far as examples, make your own!  Do your cup of tea example with the information you've learned so far and if you get stuck post your code and we'll help you along the way.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.