Database application in Zend Framework 1.12.3 in Netbeans 7.4 get data from several relational tables. – part 1

Let’s beginn Your work from create database magazine. In it create 3 tables: article,
news, author.
Author table contains columns: id, name. Article table contains columns: id, title,
content. And news table is in relation with tables: author and article. This table
contains columns: id, date_news, id_author, id_article.
I do it in MySQL in phpMyAdmin.
e20
e21
e22
In news table You need definition foreign key for column id_author and id_article.
e23Insert into tables data:

insert into author(name) values('John');
insert into author(name) values('Jenny');
insert into author(name) values('Lorry');

insert into article(title, content) values('Lorem ipsum','Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Vestibulum eleifend venenatis rhoncus. Suspendisse
vestibulum, neque eget sagittis ultricies, nibh elit tincidunt mauris, non vehicula
urna nulla et velit.');
insert into article(title, content) values('Nullam semper','Nullam semper blandit leo,
in tincidunt orci varius ac. Quisque pellentesque, sem vel blandit varius, erat lectus
semper risus, vel molestie nunc dolor sed enim. In hac habitasse platea dictumst. ');
insert into article(title, content) values('Integer gravida','Integer gravida, turpis
nec tempus placerat, tellus sapien sollicitudin tellus, eu aliquet neque lacus nec
enim. Nunc rutrum imperdiet dui, ac egestas nisi faucibus nec. ');
insert into article(title, content) values('Phasellus ut tristique arcu','Phasellus ut
tristique arcu. Maecenas id porta justo, ac blandit mi. Fusce vehicula rhoncus nibh ut
sollicitudin. Quisque lobortis quam nec leo cursus, id congue ante faucibus.');
insert into article(title, content) values('In condimentum','In condimentum quis
mauris nec interdum. Praesent auctor blandit lacus, vel porttitor dolor ultrices ut.
Nam rhoncus sollicitudin consequat. Sed adipiscing nisl eu sem malesuada, ut varius
ipsum commodo.');
insert into article(title, content) values('Sed adipiscing','Donec adipiscing leo ac
dui vestibulum, id faucibus ante mollis. Sed quam sapien, commodo vitae malesuada vel,
pharetra vel urna.');

insert into news(date_news, id_author, id_article) values('2013-12-20',1, 1);
insert into news(date_news, id_author, id_article) values('2013-12-21',2, 6);
insert into news(date_news, id_author, id_article) values('2013-12-21',3, 3);
insert into news(date_news, id_author, id_article) values('2013-12-21',3, 4);
insert into news(date_news, id_author, id_article) values('2013-12-22',1, 2);
insert into news(date_news, id_author, id_article) values('2013-12-22',1, 6);
insert into news(date_news, id_author, id_article) values('2013-12-22',3, 5);
insert into news(date_news, id_author, id_article) values('2013-12-22',3, 6);

Several author may write one article and one author may write several articles.
Implement application news in Zend Framework. Open Netbeans. Create new project
magazine. Select from menu File->New Project.
e24In Projects windows select from Categories: PHP and from Projects: PHP Application
e25Click on Next button.
In Project Name field write magazine and click on Next button.
e26In Project URL field add on the end path public word and click on Next button.
e27Choose Zend PHP Web Framework from list of frameworks and click on Finish button.
e28You see Zend project in tree structure.

e29

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.