Specifications
will send the visitor back to the headline page so that the omission of $page will not cause an
error.
The first query
select * from stories
where page = ‘$page’
and published is not null
order by published desc
finds all stories published on the specified page, with the most recently published first. Within
each loop, the uploaded image and story text are printed to the screen, followed by the writer’s
name and date of last change.
Figure 26.4 shows page.php in action, displaying all the news page items for our sample appli-
cation.
Building Practical PHP and MySQL Projects
P
ART V
602
FIGURE 26.4
Showing all published stories on the news page.
Back End
Let’s look next at how stories can be added to the system. Writers begin at stories.php. This
script, after a writer is authenticated, displays a list of the stories the author has written and
either displays the published date, or offers options of adding a new story, editing or deleting
an existing one, or setting the search keywords. An example is shown in Figure 26.5.
32 7842 ch26 3/6/01 3:36 PM Page 602










