Prev | Current Page 78 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


You can communicate with MySQL through SQL, which is a language used to interact with
the database. SQL is used to transmit to the database instructions such as ???send me the last
10 orders??? or ???delete product number 123.???
Although it??™s possible to compose SQL statements in your PHP code and then submit
them for execution, this is generally a bad practice, because it incurs security, consistency, and
performance penalties. In our solution, we??™ll store all data tier logic using database functions.
The code presented in this book was tested with MySQL 5.0 and MySQL 5.1. The role of
the MySQL server in the three-tier architecture is described in Figure 2-5.
Figure 2-5. The technologies you??™ll use to develop TShirtShop
CHAPTER 2 ?–  LAYING OUT THE FOUNDATIONS 26
Choosing Naming and Coding Standards
Although coding and naming standards might not seem that important at first, they definitely
shouldn??™t be overlooked. Not following a set of rules for your code will almost always result in
code that??™s hard to read, understand, and maintain. On the other hand, when you follow
a consistent way of coding, you can almost say your code is already half documented, which is
an important contribution toward the project??™s maintainability, especially when multiple people
are working on the same project at the same time.
?– Tip Some companies have their own policies regarding coding and naming standards, whereas in other
cases, you??™ll have the flexibility to use your own preferences.


Pages:
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90