The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Still haviing problems with PHP code

I have been trying to teach myself PHP on and off for a couple of months now. I still have a problem understanding every line of code from my Yank Sitepoint book, and another book I have purchashed (PHP and MySQL for dynamic websites Larry Allman). Both, I'm sure, are excellent books, but I still have difficulty digesting PHP coding techniques. In particularly the multiple techniques that can be used concerning arrays, varibles, and conditional statements.Both books teach in an entirely different manner. Is this a case of practice makes perfect? I find myself going back to the beginning of both books and starting the exercises over when I see something in the code that is not recognizable. My goal is to understand, not just copy an example from one of my books and alter the programming for my site. It can be very frustrating. PHP & MySQL are essential to making my website a reality. Can anyone give me some suggestions?

If you find you're not understanding the way a book is teaching something, you can only try a different book - all writers have different styles to impart knowledge, some will work for you and some won't.

If there's something specific you are struggling to get your head around, post it here.

Do you have any programming knowledge or PHP your first experience with programming? If you don't have any experience it might be better going for a simpler book such as Programming PHP (O'Reilly). There's also a load of beginner tutorials online (just type "php tutorials" into Google).

My advice is to start simple - don't expect too much too soon. Programming is an art and you can't expect to do it without understanding the tools used to do it. Firstly learn about variables, strings, arrays, expressions, operators and flow control constructs (more or less in that order) and then start to construct some simple scripts. The best way to learn from there is to code up some simple pages to do some basic things like constructing tables from arrays or printing out different messages depending on what day of the week it is. From there you can start looking at databases, objects and form handling. By this point you should be well away and things in your existing books will begin to make sense.

As Buddy Bradley said if you have specific questions then you can post them here - people are very helpful and willing to solve problems.

Arrays are the first "hurdle" new programmers have. They're rather invaluable, and a lot of new programmers struggle to understand how they work and fully recognize their uses.

As Buddy said, though, not everyone is made to be a programmer. That's not a knock -- people are just built differently. I'm sure not going to try and replumb my house, or fix my car. Or even pick out matching colors.

Thanks everyone

I think tim912 hit it on the head. PHP takes time. I do feel I have the ability as I do digest some of the material.. At times I bite off a little more than I can chew in my haste to create my website. I think I am bit impatient. I will prevail (how's that for positive thinking?)! In the mean time, stay tuned for dumb question or two on this same channel! Thanks for the help and suggestions.

The Right Book

Originally Posted by Buddy Bradley

If you find you're not understanding the way a book is teaching something, you can only try a different book - all writers have different styles to impart knowledge, some will work for you and some won't.

Truer words never spoken! I remember when I was trying to learn "C" years ago. Every time I opened the book I had, it was like hitting a brick wall. I finally found a book that worked for me.
A good book that works is like a breath of fresh air and worth its weight in gold.

I usually spend a lot of time on Amazon.com reading the book reviews before deciding which to go with.

"Three components make an entrepreneur:
the person, the idea, and the resources to make it happen."Anita Roddick ~British entrepreneur
dbr founder of: ProximityCast.com

MY first question would be: What other programming experience do you have?

If you have the energy stick with it, maybe try a few different books or some of the great tutorials on the web BUT there are times when you just have to face the fact that you may not be cut out to be a programmer.

No that's not being mean! I had to say that exact line to more students than I can count, it sucks to have to say it but more than not it's the truth.

Not everyone is cut out to be a programmer or developer, just like not everyone has talent for design and graphic work. If anyone could do it there wouldn't be any such thing as a programmer!

Programming takes a special kind of person. They are the ones that can't STAND to leave a puzzle half done. Warped is a good term for it and I count myself in that group. It takes a good ability to solve problems while looking at the big picture. It takes patience and persistence like you have never seen.

Now if you are coming from another language other than PHP I sympathize completely. I did Java for 5 years before I switched to PHP and it was the worst experience of my life!

So don't just quit, try other avenues to learn what you want to learn. Maybe (if you haven't programmed before) take some basic programming theory courses... but also be aware your talents may be better used in something else.

PHP was not my first language. I started with AppleScript, which really taught me the basic concepts of programming (loops, conditionals, variables, etc.) Then I dabbled in C a bit. I never really learned the language, but I gained a much better knowledge of programming.

Thanks again

Thanks everyone for your time and comments. I did'nt start this project with the intent to give up. I will press on. Eventually my goal of having a correctly configured website will become a reality. Already I have emmulated my laptop as a server. I am also quite comfortable with HTML (thanks to Sitepoint). I'm halfway there. No sense in giving up now.
Thanks again everyone for the help!

A bit at a time

It sounds like your trying to understand everything all in one go. I would start with variables and if statements. Just start writing it and you will pick it up. Dont read as much until you actually start doing it it wont be clear.

I learned the basics of PHP from http://www.w3schools.com/php/. I then looked at simple scripts and slightly edited them. I can't remember what I've done after that, truthfully. A good PHP tutorial (which unfortunately I didn't use during my beginning stages) is http://hudzilla.org/phpwiki/. It's a great online tutorial that will teach even advanced programmers a thing or two.

I find no need of buying programming books unless you just are a book person.