11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 24 • INTRODUCING THE ZEND FRAMEWORKwww.it-ebooks.infolist($name, $email, $telephone) = $result->fetch_row();?>Contact Information for: Employee Name: Email: Telephone: Recent Absences// Retrieve employee absences in order according to descending date$query = "SELECT absence_date, reasonFROM absences WHERE employee_id='$eid'ORDER BY absence_date DESC";// Parse and execute the query$result = $mysqli->query($query, MYSQLI_STORE_RESULT);// Output retrieved absence informationwhile (list($date, $reason) = $result->fetch_row();echo "$date: $reason";}// Include page footerINCLUDE "footer.inc.php";Because the design and logic are inextricably intertwined, several problems soon arise:• Because of the intermingling of the site’s design and logic, the designers who werehired with the sole purpose of making your web site look great are now faced withthe task of having to learn <strong>PHP</strong>.• The developers, who were hired to help out with the expansion of web sitefeatures, are distracted by fixing the bugs and security problems introduced by thedesigner’s novice <strong>PHP</strong> code. In the process, they decide to make their own littletweaks to the site design, infuriating the designers.• The almost constant conflicts that arise due to simultaneous editing of the sameset of files soon become tiresome and time consuming.You’re probably noticing a pattern here: the lack of separation of concerns is breeding anenvironment of pain, distrust, and inefficiency. But there is a solution that can go a long way towardalleviating these issues: the MVC architecture.The MVC approach renders development more efficient by breaking the application into threedistinct components: the model, the view, and the controller. Doing so allows for each component to becreated and maintained in isolation, thereby minimizing the residual effects otherwise incurred shouldthe components be intertwined in a manner similar to that illustrated in the previous example. You canfind detailed definitions of each component in other learning resources, but for the purposes of thisintroduction the following will suffice:458

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!