Using mysql records and field content for page templates (1 Viewer)

ajetrumpet

Banned
Local time
Today, 11:37
Joined
Jun 22, 2007
Messages
5,638
all,

i am beginning with mysql and i would like to build a db driven site right the first time, so i don't have to deal with unnecessary changes in the future.

my question is simply: what is the general process for displaying web pages using content from a mysql database?

i have not done any research, and i'm not asking for PHP code to do this, but I simply want to know (in my mind's eye) how this stuff is done. Here are my assumptions:

***Webpage templates are created with layout objects on them (positioned accordingly), be it tables, frames, image placeholders, and whatever else.
***PHP is written to pull the content out of the record specified through the various fields, based on the query string in the URL.

if that is simply the case of how db websites work, it seems like a relatively painless process, but still a long one. is this how things generally work? and if so, are the controls on the webpage dynamically populated with the PHP code, or can the controls have some sort of "tag" attached to them (sort of like a bound field on an ACCESS form) that basically says, "display the content from field "A" based on the query string".

thanks for any input on this! appreciate it!
 

Banana

split with a cherry atop.
Local time
Today, 09:37
Joined
Sep 1, 2005
Messages
6,318
I believe there are two approaches to it:

1) Use MySQL's LIMIT. In Access and SQL Server, we use TOP but MySQL doesn't work this way.

Code:
SELECT * FROM foo LIMIT 100;

means to get 100 records from table named 'foo'. However, LIMIT can take two arguments:

Code:
SELECT * FROM foo LIMIT 1, 100;
SELECT * FROM foo LIMIT 101, 100;

First query returns the first 100 record, while second query returns the next 100 records starting at 101st record. So you got a built-in paging functionality.

Second approach is that PHP also provides something like this in its MySQL connection library but unfortunately I didn't remember the function call. I'd look in the MySQL's PHP connector documentation.

HTH.
 

ajetrumpet

Banned
Local time
Today, 11:37
Joined
Jun 22, 2007
Messages
5,638
thanks for the reply banana.

I'll check out the libraries. what you explained to me though doesn't exactly match what i was asking. thank you for the info. i'm sure i'll find it useful
 

Users who are viewing this thread

Top Bottom