Monday, October 15, 2012

Zend MVC Structure

  • Model - This is the part of your application that defines its basic functionality behind a set of abstractions. Data access routines and some business logic can be defined in the model.
  • View - Views define exactly what is presented to the user. Usually controllers pass data to each view to render in some format. Views will often collect data from the user, as well. This is where you're likely to find HTML markup in your MVC applications.
  • Controller - Controllers bind the whole pattern together. They manipulate models, decide which view to display based on the user's request and other factors, pass along the data that each view will need, or hand off control to another controller entirely. 

    This post is taken from http://framework.zend.com/manual/1.12/en/learning.quickstart.intro.html. More info you can get from it.

Friday, November 5, 2010

Debug PHP. Ask the Expert.

'Al-salam ala man tabea al-huda' (Salam upon those who follow 'the true guidance.')

Here I like to share the skills of debugging.

1.) print_r(); Use to display the value of an array or variable.

Example:

$arr1 = "This is a test";

echo "<pre>";
print_r($arr1);
echo "</pre>";
die();

2.) If u r expecting some result from your sql statement then you should print_r and die your sql statement. Then you have to copy paste the sql statement to your phpMyAdmin.

Example:
$mycity = Selangor;

$query = "SELECT * FROM Persons
WHERE City='.$mycity.' ";

print_r($query); die();

Then u will get:
SELECT * FROM Persons WHERE City= 'Selangor'.

Go to your phpMyAdmin, choose your database then click SQL.
Copy n paste the result to the SQL box then click Go.
Then find out the error. Use your brain. :)

That's All. All the Best. Any Questions you can ask here. InsyaAllah I will reply to you soon.