homepage Welcome to WebmasterWorld Guest from 54.237.235.12
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
DB Table or fopen
Begginers advice
Revata

5+ Year Member



 
Msg#: 4003870 posted 5:41 pm on Oct 8, 2009 (gmt 0)

I've got a page on my site that displays 8 rows of data from a recordset at a time and paginates to the next/previous 8 accordingly.

I want to be able to control the number of records displayed per page on the backend CMS page where I add/edit entries in the database, and I'm wondering if it's necessary to set up and entire table in the DB for that one value or if I should do something like set up a simple text file with the value in it that is opened and edited with the file functions like fopen, fwrite, and such.

I feel like there is probably a very simple way to do this and I'm going the long route here.

 

TheMadScientist

WebmasterWorld Senior Member themadscientist us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4003870 posted 6:14 pm on Oct 8, 2009 (gmt 0)

Personally, I'd probably go with the table, just because it provides so much ease of use / flexibility as you wish to add other setting or controls the displaying the DB results...

Revata

5+ Year Member



 
Msg#: 4003870 posted 7:22 pm on Oct 8, 2009 (gmt 0)

OK, that's kind of what I was thinking but thought maybe there was something i wasnt thinking of.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4003870 posted 7:30 pm on Oct 8, 2009 (gmt 0)

I'm wondering if it's necessary to set up and entire table in the DB for that one value or if I should do something like set up a simple text file....

If this is your only value, text is fine - however - if you have an administrative back end, you are very likely to have at least a few and should have a LOT of configurable variables.

Some examples,

- per_page (the one of which you speak)
- Page titles - what if the owner wants to change their shopping cart heading from "Shopping Cart" to "Shop for Widgets?" And . . . they don't know how to, or you don't want them futzing around with, the HTML/PHP?
- Owner email, for responses, email functions . . .
- company name, number, address for display in various places . . .
- CSS selector names used by your scripts, so these can be changed if the owner experiments with different styles

You get the picture. One of the biggest problems I have with most existing code I'm asked to "fix" - nearly all of it has hard-coded values in places that should be variables that are either set at the head of a global include or extracted from a database.

If you extract them from a database, they become configurable, if they are configurable, your project is portable . . . . and you can see where that goes.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved