PHP MySQL Website Programming 160
PHP MySQL Website Programming Problem - Design - Solution | |
author | Chris Lea, Mike Buzzard, Jessey White-Cinis, Dilip Thomas |
pages | 504 |
publisher | Apress |
rating | 9 |
reviewer | Alan Knowles |
ISBN | 1861008279 |
summary | Effective learning through the Problem, Design, Solution approach |
In brief:
This book takes you through designing a PHP website, featuring the usual bundle of generic features, simple content management, adverts, forums and an on-line shop. It's not intended as a definitive codebase of the absolute best design, but fills a big gap between trying to develop PHP with functions and lots of include files, and the full Computer Science bible of Design patterns.For those people (and there's a lot of them) who have grown from Word macros and Visual Basic, then had a lot of fun learning PHP, this book provides an excellent gentle path towards using classes in PHP and applying them to real world problems. Like a lot of Wrox books, it's jam-packed with code, with a good flow of new information in each chapter.
What I liked
As a programmer who many years ago swore blind that there was no reason for using classes and objects on websites (the equivalent to a misspent youth), this book gives good clear examples on how they can provide advantages over just 'include' and a few functions.
The book is enjoyable to read; it focuses on the step-by-step delivery of a very dynamic website,starting with the basics of designing the file layout and how the files will work together. It then goes into more detail on delivering each feature, provides enough general ideas to help most PHP enthusiasts and budding developers understand the basics and advantages of OOP programming (although there are a few functions thrown in to ease in those not conversant with OOP).
The website that you learn to create (using the Problem - Design - Solution approach) is available for you to see online here.
Although a lot of the code is focused around implementing a reasonably simple set of Patterns, Data Objects and Page execution scripts, there are a few gems in there.
- Utilizing quite a few PEAR classes including the Database abstraction layer, Mail Sending.
- A nice section on the basics of RSS and XML, not to detailed level, but a good warmup for anyone coming from a System Admin or Simple Visual Basic level.
Ok, It's not for everyone. If you've done any Java or C++, this book is going to be a bit below you. Design Patterns are not mentioned directly in the book, although a number are implemented. The book misses out on quite a few important ideas, like templating php sessions in the body, although it does touch on the subject near the end. Given the target audience, of PHP of beginner to intermediate level, it does have a few unusual code styles in places, which hopefully the readers will not over-apply.
What you will learn from this book
- Elements required to build a useful 3-tier web application
- Design and construct an interactive User Interface (UI)
- Provide a CMS environment to manage content securely and extensively
- Create visitor accounts, to register and manage unique site visitors
- Build a simple news management and delivery system
- Create a syndication application
- Generate a sustainable revenue stream from advertising
- Implement an online visitor poll
- Create a fully featured discussion forum
- Build an online shopping cart system with checkout features
Summary
While personally this isn't the book for me, as I've learned far too much PHP for my own good, it's the book you wish half the sourceforge PHP project coders would read before starting their project, saving you a wasted download. In the end it's ideally suited to a PHP website development training course, and could almost be the course book. (However, it's better written than most of the school books I remember).
You can purchase PHP MySQL Website Programming from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Who needs this? (Score:4, Funny)
MIS = all you need to build ecommerce site? NOT. (Score:2, Informative)
Re:Who needs this? (Score:2, Funny)
In this time I have worked for two PHD's in computer science and both thought I also had a PHD because they had to come to me to find out how things realy work.
Irony (Score:2)
Well, I don't doubt the high school education part....
Re:Who needs this? (Score:1)
Why WOULD you use classes and objects? (Score:5, Interesting)
Let's face it, by the time you've declared you classes, instanced everything a procedural approach would probably have executed and be wating for the next client...
Re:Why WOULD you use classes and objects? (Score:5, Insightful)
Ease of use. Once you've got your objects rolled up, just plug em in and go.
Uhm, do I really have to explain the benefits of object oriented programming?
The performance hit is something of an issue, but I think it's going to be resolved with the Zend 2.0 engine in PHP5.
Re:Why WOULD you use classes and objects? (Score:1)
To solve the initial problem - implementing all the required classes when you only need simple functionality - I wrote an code generator. You can try it here: http://titaniclinux.net/daogen/
It generates PHP and Java value objects and DAO classes.
Re:Why WOULD you use classes and objects? (Score:5, Informative)
You cite:
They're the building-blocks of OO, and the benefit is the flexibility that those building blocks give you. If you're a good programmer who writes procedural code, you'll usually find these features seeping into your programs anyway. Languages with OO features just make it easier to apply them. They are polymorphism (you know how to deal with a "car", so you don't have to read the manual to start up a "compact car"), inheritance (a "Pinto" is a "compact car" with some special differences like its own version of the "react to rear-impact" event) and encapsulation (a "car" has a "dashboard", a complex object with behaviors of its own). IMHO, polymorphism is the most powerful and valuable of these, though many will focus on inheritance, which is deeply tied to polymorphism anyway, so YMMV.
Re:Why WOULD you use classes and objects? (Score:1)
Even many OO fans agree that "OO is not about reuse". The reuse push seems to be falling out of favor as a top selling point of OO. (See: http://www.c2.com/cgi/wiki?ReuseHasFailed, generally a pro-OO group.)
Ease of use. Once you've got your objects rolled up, just plug em in and go.
I used to use FORTRAN graphics components, and I do not see any significant differences between them and OO components. Perhaps you were just a shitty procedural p
Re:Why WOULD you use classes and objects? (Score:2, Informative)
Unless each bit of data is always only shown once in a system, there is a place for classes and object.
Re:Why WOULD you use classes and objects? (Score:1)
Right on. It also lets you bolt on an XML-RPC or SOAP interface later on, which is what we've done with GForge [gforge.org].
Tom
No, not really (Score:2)
It all depends on what your needs are what is appropriate. For most sites, putting everything in objects is overkill. I worked on a site th
Re:No, not really (Score:3, Interesting)
Bottom line, it all comes down to what works for you and how you learn to think. I was struggling with using OO at my new job (They encouraged OO but there was st
OOP Speeds Development (Score:2)
People seem to be more concernded with development speed on the web (most web languages are interpreted, which speeds development at a massive expense of runtime speed) so OOP is natural for web languages.
Anecdotal (Score:2)
Maybe you work at a shop that did a big push for quality, and incorporated modularity and good documentation in with the conversion to OO? Speed of development is definitely the biggest thing in the web, and with my standard include libraries
Re:Why WOULD you use classes and objects? (Score:2)
OOP is totally useless for the web script itself, whi
Re:Why WOULD you use classes and objects? (Score:2)
Eh? Isn't the HTML tag a good logical object to base programming around? By pointing an HTML form input object to a CGI form data object, you could create form objects capable of not only printing themselves (such as <input type=text maxlength=20> from a TextInput object) but also automatically ensuring the submitted form's values are within specified bounds (i.e. cropping off a post
no... (Score:2)
a good example of an object would be 'customer', 'order', 'account', 'product', etc.
there's a performance hit to instantiate an object. why do so when simple client or (as a second line of defense) server side scripting can do the validation you're talking about? With Visual Interdev Microsoft tried to do the kind of thing you're talking about, having HTML fields generated by programming code, and it was a complete waste of time. HTML works, just
Re:Why WOULD you use classes and objects? (Score:3, Interesting)
You only pay for instantiation (setting up of classes) once, at the time of the class's creation. I have seen many projects fail to keep often used classes around, or worse, design a system that demands the recreation of often used duplicates.
Most of the time this is due to fresh java talent leveraging their accumulated problem so
Good and bad reasons for OO (Score:3, Interesting)
That being said-- there are several reasons why I might use classes and objects:
1) Complex data types being moved around. I often use them like structs.
2) Sometimes extremely complex and recursive data structures be
Re:Good and bad reasons for OO (Score:1)
I am curious as to why OO allegedly makes this easier. Could you by chance provide more details? Thanx
SOAP integration is FAR easier with OO programming.
Not surprising since SOAP is based on the OO paradigm. It is a matter of talking the same (or
Re:Good and bad reasons for OO (Score:2)
I am curious as to why OO allegedly makes this easier. Could you by chance provide more details? Thanx
The idea was to generate a reporting engine which created a PDF complete with sections, etc. and fill things in at runtime. The report definitions wou
Re:Good and bad reasons for OO (Score:2)
I looked at a few but they didn't seen to be what I was looking for. Not extensible enough, or not Free as in GPL (the program was released under GPL) or not easily integrated with a PHP application.
I have seen some quick database engines. But, I would rather focus on good software engineering rather than speed.
When I wrote HERMES, the common parts of the
Re:Why WOULD you use classes and objects? (Score:1)
And then later, if you needed to switch to PostgreSQL, you would change one line of code:
Sure, you could write an abstraction layer and rewrite that if you wan
Re:Why WOULD you use classes and objects? (Score:2)
$con = new dbMySQLCon(server params here);
$res = $con->Exec("SELECT * FROM users");
for($i = 0; $i NumRows(); $i++)
DoSomething($res->Result($i, "field"));
And then later, if you needed to switch to PostgreSQL, you would change one line of code:
$con = new dbPostgreSQLCon(server params here);
I've never used PHP, but I hope that the above does not r
Re:Why WOULD you use classes and objects? (Score:2)
Re:Why WOULD you use classes and objects? (Score:1)
$con = new dbPostgreSQLCon(server params here);
Sure, you could write an abstraction layer and rewrite that if you wanted to change the underlying database, but then you wouldn't be able to use multiple databases in the same script.
I don't think you need OO for that. You could use *named parameters*, but unfortunately, PHP does not provide those. I miss named parameters.
$con = DBconnect();
$con = DB
Re:Why WOULD you use classes and objects? (Score:3, Insightful)
Let's face it, by the time you've declared you classes, instanced everything a procedural approach would probably have executed and be wating for the next client...
It's already going to be twenty times slower than a custom Apache module in C. Performance is not the hallmark of interpreted scripting languages, development costs are. So if you're looking as whether you use classes or procedural scripts, the deciding factor is not going to be whether it took .01 seconds or .02 seconds to generate the
Thank you (Score:2)
Re:Why WOULD you use classes and objects? (Score:2)
One object type I have is a "renderer". Its job is to output my data in whichever form I ask.
Here are three different renderers operating on the same data:
Old [dyndns.org], new [dyndns.org], RSS [dyndns.org].
I also have Parser object that uses the Expat PHP interface, objects for news
Re:Why WOULD you use classes and objects? (Score:2)
Re:Why WOULD you use classes and objects? (Score:2)
I just made it valid XHTML Transitional 1.0, but it probably still crashes Safari. Ah well. I'll have to snag Opera before I go live.
Re:Why WOULD you use classes and objects? (Score:2)
Re:Why WOULD you use classes and objects? (Score:2)
Re:Why WOULD you use classes and objects? (Score:1)
Sometimes its easy to keep track of state in a class and while you can do this without
Re:Why WOULD you use classes and objects? (Score:2)
Re:Why WOULD you use classes and objects? (Score:1)
You could preload your code (and some kind of pre-compile) with a php script cache software like PHPA [php-accelerator.co.uk]. BTW in PHP4 an object ist like an array with a table of its own functions-scope (its methods). Thus oop in PHP4 is pretty fast. PHP5 has a little bit more overhead (an object is a handle refering to the object table) but with many advantages
Re:Why WOULD you use classes and objects? (Score:2)
If I'm calling a function, I should be explicit about what I'm passing in and what I'm returning. Using GLOBAL in functions should not be done. Can you give me examples of what you'd need to globalize in a function (or method)?
There are a couple times I've had to do that, which pretty much just drove home the fact that the app wasn't architected properly in the first place.
Re:global scope in PHP (Score:1)
There are a couple times I've had to do that, which pretty much just drove home the fact that the app wasn't architected properly in the first place.
First off, it is not really "global" scope, but "regional" scope that is sought. (Session vars would be the closest to true glob
Sounds familiar? :-) (Score:5, Funny)
Build a simple news management and delivery system
Generate a sustainable revenue stream from advertising
Implement an online visitor poll
Create a fully featured discussion forum
?????
Profit!!
Re:Sounds familiar? :-) (Score:4, Funny)
To those familiar with it, #5 obviously is:
PHP Design (Score:5, Insightful)
The problem is that with security, the very best possible way to keep your site secure is to a) purify incoming data and b) keep your source to yourself unless you want people to let you know where the bugs/holes are. I know the open source community is really good and has it's place, but when it comes right down to it, if you fully customize your PHP, then it's more secure because there aren't a bunch of script kiddies looking for ways to hack you on security forums (a la PHPBB script attacks). The good thing about PHP in the open source sense is that you can read it and understand how it works. I don't recommend using any custom packages because there is risk involved that your doing so is going to attract attention from script kiddies. The best thing you could do is learn PHP by the open source examples (run phpbb and read it, run smarty and read it - understand it) but then create your own base, and add your own layers to it.
Re:PHP Design (Score:5, Informative)
The problem with this philosophy is that it allow you to be sloppy with your code. You might start out with great intentions of keeping the code clean, but without the fear of ridicule associated with peer review, you will start to slip to catch that deadline.
Knowing other people are going to see the code is the best way to keep a programmer in line. An artist is not going to show all the crap they come up with to the world. They pick their best work and share it because they are proud of it.
Now if only I could adhere to this philosophy myself...
Re:PHP Design (Score:2)
So it becomes a question of what you'd prefer. A public change to see the error pointed out
Re:PHP Design (Score:3, Interesting)
I have been saying for years now that PHP design needs to be somewhat standardized so that we can all make our mods fit better.
Fit better with what? If you want a standard Web site, there's plenty of content management systems out there with a variety of module interfaces to choose from. If you want hard-core general purpose modules, look no further than PEAR [php.net].
If you're suggesting there ought to be something between those 2 then go ahead and start a project, but I think there's plenty of open-sou
Hold it right there! (Score:5, Funny)
What do you mean, "fun learning PHP?" I'm a Microsoft guy and there's only one way for me... the Microsoft way. Buddy, I think you should be talking about ASP and VBScript, the nectar of the gods.
I started my career hacking up Word macros, then slowly picked up Visual Basic. I can't wait to see what Microsoft has in store for me next. Maybe Visual C#? Hmmm... I won't touch anything non-Microsoft with a ten foot pole, because Microsoft always comes out with the best cool shit and I'm a big fan.
I don't know why you people can't just accept Microsoft and all its products and move on with life.
Re:Hold it right there! (Score:2, Funny)
Microsoft pays my bills.
And since I've pulled out all my hair, I don't have to worry about hair cuts, I get to spend that 1/2 hour/month reading MSDN magazine!
Also, they helped provide me with this nice padded room, the walls are soft and squishy. Really nice.
Re:Hold it right there! (Score:1)
You deserved a Score:5, Troll for that one!
Two Problems? (Score:5, Funny)
There are three types of people in the world: those who can count, and those who can't.
Re:Two Problems? (Score:2, Funny)
Ahhh, reminds me of the Monty Python sketch.
Ximinez: Nobody expects the Spanish Inquisition. Our chief weapon is surprise ... surprise and fear ... fear and surprise ... our two weapons are fear and surprise ... and ruthless efficiency. Our three weapons are fear and surprise and ruthless efficiency and an almost fanatical devotion to the Pope ... Our four ... no ... amongst our weapons ... amongst our weaponry are su
Re:Two Problems? (Score:2)
Re:Two Problems? (Score:2)
I read that sentance, and I was looking for the second thing you'd cringe from. Spaghetti Code is a maintenance nightmare, and modifying it is horrific.
What was the second point?
Re:Two Problems? (Score:1)
Classes? (Score:5, Insightful)
As a programmer who many years ago swore blind that there was no reason for using classes and objects on website
I put together a javascript/php-based web aministration tool for a web site, that without classes, would have been a nightmare. Classes aren't necessary in every case, but when the problem space reaches a certain level of complexity, NOT using them can be a very poor choice. But then, after one decides that classes would be appropriate, using them effectively is a whole different ball game.
Re:Classes? (Score:1)
Re:Classes? (Score:2)
If you need to perform updates, putting your business logic in an object, rather than a stored procedure, can have its own
build great code like this (Score:4, Funny)
in 24 hours
Re:build great code like this (Score:1)
The parent may have been joking, but they make a good point about one of PHP's weaknesses. Because PHP can just spew out HTML at random points using echo or print you can unintentionally write strings of HTML, 400, 500, 600 characters long without a newline. That sucks.
Actually, it's not totally PHP's fault. It's pretty obvious that the echo statement doesn't actually output a newline each time you use it. This is very useful, but it's a problem when you're using it as an Apache module or CGI scripting
Re:build great code like this (Score:2)
all languages have print / echo etc. (Score:2)
int main(int argc, char* argv) {
printf("Content-type: text/html");
printf("");
printf("<html>");
printf("<head>");
printf("<title>CGI in 24 hours</title>");
printf("</head>");
printf("<body>_insert_body_text_</body>")
printf("</html>");
}
PHP has a bad rep because most people look at it from the wrong end, the "Learn PHP in 15 minutes" end.
my code looks more like this
<?
require_on
SAMS PHP and MySQL - Web Development? (Score:2, Interesting)
I used this one to get going, and found it very useful. Does anyone know if the book reviewed here
presents any significant benefits over the book I mentioned?
See also... (Score:3, Informative)
Object Oriented Classes (Score:4, Informative)
My biggest gripe about PHP in regards to classes is that you CANNOT create a deconstructor function in your classes. Their reasoning is that they cannot make it where you know which order the deconstructors will be called.
Instead, the workaround is to create a function to handle the script ending using register_shutdown_function(). This is incredibly annoying, and for the most part I don't even use it. It just forces me to write a function called ClosePage or something to that effect.
I like classes, and it's worth at least looking into using them on your pages (at least for code you'll be constantly reusing). For those of you who are concerned about speed in using classes, get PHPA [php-accelerator.co.uk].
Hopefully PHP5 will fix some of the issues in using classes in this language. But until then, be hesitant.
Re:Object Oriented Classes (Score:2)
buy it cheaper at amazon (Score:2, Informative)
There's also a $5 off $35 coupon floating around...
Don't bother (Score:4, Interesting)
The example code is contrived and ignores a lot of real world problems. Of course, if you're writing a shopping cart of your own, you won't learn anything new here. If you don't know php and want to add some dynamic content to your web pages, it's a good book, though.
Question (Score:1)
Does this make me 1337?
Not just a PHP problem (Score:5, Informative)
Part of the reason it applies so readily to this language, however, is the conceived ease-of-use. A lot of newbie users swap to PHP, pick up some bad samples, combine with existing bad habits they never grow out of, and eventually consider themselves "knowledgable" just to to long-term use. However, experience in duration != experience in education (standardization, etc).
To shift the blame from PHP, I've been working on attempting to integrate a 3rd-party web-based system (Perl-base) into my place of work. At first, I looked at the code and estimated that I could do it relatively easily. What I neglected to realize, is that while some of the coding was done reasonably well... this seems to be a multi-person project and other sections are nightmarishly and un-necessarily complex.
We need an article on "signs that you're working with bad code." So far I've found...
Re:Not just a PHP problem (Score:1)
Offtopic, but, FYI, use of perl/shell style comments is discouraged by PEAR [php.net]. I think if PEAR standards were more visible, we'd see less freakish code. Although, why they choose to use Allman over 1tbs is beyond me (-:
Re:Not just a PHP problem (Score:2)
Contents... Introduction...Index.... (Score:2)
Sounds like a good additional chapter to me, but the name might be a bit long...
More 'signs you're working wih crappy code' (Score:2)
Here are a few more, about as fatal:
1) Lots and lots of global variables. Any attempt to modify or replace any of them will lead to catastrophic failure. Needless to say, none of this is documented. Anywhere.
2) Functions with more than three or four parameters. Be especially wary of functions that interpret their parameters in diff
The Superiority of PHP over Perl (Score:1, Troll)
Before I begin, let me just clarify something. I'm not arguing that PHP is better than Perl in all cases. There is certainly still a use for Perl. Also, PHP isn't perfect but it doe
Re:The Superiority of PHP over Perl (Score:1)
Nice troll. Very cute. I guess the reason why you haven't been flamed yet is that the Perl programmers can see it's a troll and the PHP users don't care either way.
czth
Re:The Superiority of PHP over Perl (Score:1)
I've been reading more about php lately as I'm thinking about making a new website, and it seems as easy, I just haven't tried it yet. Wh
Same Cut-and-Paste troll as usual (Score:1)
See for yourself [slashdot.org] and please mod down this stupidity.
Repeat troll (Score:4, Funny)
The astonishing thing is that it continues to work!
Open source doesn't need a book to be better (Score:2, Insightful)
I take exception to this. Open source flourishes at all levels; the inexperienced, the intermediate, and certainly at the expert level. In fact, it is the progression of people from distributing code to distributing useful code that makes open source what it is.
The day you can't download garbage code is the day open source dies.
PHP frameworks (Score:4, Informative)
Ports of Struts
PHP.MVC [phpmvc.net]
Phrame [ttu.edu]
And ezPublish 3 [ez.no] which is primarily a CMS but can also be used as a general purpose framework.
IMHO for one of these to really take off (like Struts) is what professional PHP development needs.
In other words (Score:2, Funny)
OOP is waaaay oversold (Score:3, Interesting)
The world's patterns of change tend not to be hierarchical nor polymorphic. These "taxonomies" are artificial structures introduced by OO authors, but there is usually no "tree cop" or "polymorphism cop" in the real world that assures that new changes fit the shape of these concepts. Change is more random in my observation than OO proponents assume. Marketers and bosses that ask for new features don't care about the shape of OO when they invent requests. OO books present an artificial view of change patterns, and students take it as gospel. We need more science and less doctrine. To build good, lasting software, one has to first become a student of change. The change patterns I have observed so far do not fit OO for the most part.
OOP Criticism Website [geocities.com]
Re:OOP is waaaay oversold (correction) (Score:1)
Re:OOP is waaaay oversold (here, here!) (Score:2)
Re:OOP is waaaay oversold (here, here!) (Score:1)
Amen! One of the techniques I try to apply is "virtual abstraction" (AKA "local abstraction", "temporary abstraction", "ad-hoc abstraction) using relational queries and other techniques. Philosophers have generally concluded that there is no such thing as universal (global) taxonomies and abstractions. Too ma
If I had a small chimpanzee mind... (Score:2)
Being a chimpanzee, I wouldn't realize I couldn't hit an abstraction, so I'd probably continue like this for 3 or 4 hours.
PHP is great! I wouldn't know! (Score:1, Offtopic)
I've spent on the order of tens of hours just trying to get PHP, MySQL and Apache to play friendly together with no success. I've decided that when someone creates a PHP, MySQL, Apache integrated distribution, then I'll return to trying it out. Until then, I'll stick to Apache + Perl or Tomcat.... It makes building a KnowledgeBase app much more difficult though!
Re:PHP is great! I wouldn't know! (Score:2)
Give a try to ApacheToolbox
Re:PHP is great! I wouldn't know! (Score:2)
Under which OS?
I was able to get things working pretty quickly under Windows. It was only when I had to upgrade to Apache 2.x to use some features that were still in beta, did I have any problems.
(shrug) That what you get when you start using non-stable releases.
Re:PHP is great! I wouldn't know! (Score:2)
PHP installation is difficult? (Score:2)
QUICK INSTALL (Static)
./configure ..
./configure --with-mysql --with-apache=../apache_1.3.x
../apache_1.3.x ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
$ gunzip -c apache_1.3.x.tar.gz | tar xf -
$ cd apache_1.3.x
$
$ cd
$ gunzip -c php-4.x.y.tar.gz | tar xf -
$ cd php-4.x.y
$
$ make
$ make install
$ cd
$
(The above line is correct! Yes, we know libphp4.a does not exist at this stage. It
Re:PHP installation is difficult? (Score:2)
Re:PHP is great! I wouldn't know! (Score:1)
apt-get install apache php4 php4-cgi mysql-server
Then uncomment the necessary lines in
This is just with Debian though, I believe there's probably a v
Fusebox with PHP (Score:1)
I have used Fusebox with several Cold Fusion applications and have that it with FuseDoc are a great combination for creating a webapps in a standard fashion. It allows new developers who are familar with the Fusebox structure to pick up on your design quickly and implement their assigned pieces in a more reusable manner. He
running gag.. (Score:1)
ouch, I've been hit by a reference - again!
it's not funny. I spent hours today because of PHPs whimpy OO implementation.
Shopping cart is a terrible example (Score:4, Informative)
TERRIBLE!
I type in 9999999 (ad infinitum) in the quantity field and hit update.
My quantity is mysteriously changed to 147483647. I'm just guessing that's the limit of signed ints on that server. No error message was displayed. Since the size of the field that displays the quantity box is 3, all you see is '214'. An end user of an e-comm site doesn't care what's behind the scenes, they care that the inputs/outputs make sense. This doesn't. The reviewer talked about Design Patterns. Who cares? On the web the first rule you need to follow to have a reliable application is 'Validate user data'. Do that obsessively and you'll probably be ok even if your back end isn't too slick. Fail to do that and you are sunk, no matter how efficient your code is.
Then just to be sure I wasn't being too harsh, I ordered -3 of another movie. Works fine. So you can order three of one movie, -3 of another, and get them for free. Sorry.... a shopping cart without data validation (tedious as it is) isn't a shopping cart.
I hit continue and am told I need to have an account first. I sign up for one. First thing - I'm prompted for my login. Grrr... pet peeve - maintain this in the session please. Then I'm not redirected back to the cart. Oops... lost sale there. So I continue.... lovely, I'm informed that "Error_ Your shipping info is not valid." Man... insulting too. I hate apps that set a user up to fail.... and this does. I update my shipping address as prompted... and nothing happens, I don't go back to the flow of purchasing. Yikes, another lost sale. Even on the last step, my -19.99 order is accepted with no problems.
I know the shopping cart is being offered as an example only.... but c'mon, it should be a workable example. I am looking to learn PHP, but think I'll look elsewhere.
my php project (Score:2, Interesting)
Dear gods! (Score:2)
Just for fun, couldn't someone write a "mod_perl and postgres" book? Though even that would be pretty redundant at this point... Or just for giggles, "JavaScript and SAPDB" or something? (Ok, come to think of it that mig
PHP sucks... (Score:2)
Firstly, not only is it extremely forgiving of sloppy coding styles, it's design even seems to encourage it. It's typing logic is a pain - variables get assigned a type implicitly, and then you have to use functions to test what type they are. In fact, there's a function for just about everything. No, they aren't arranged sens
Re:PHP, JSP, ASP ??? (Score:1)