Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

59 users online



Correct me if I'm wrong (again)

Correct me if I'm wrong (again)

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 4
Agatio

Agatio

Neversidian
Status: Offline!

Correct me if I'm wrong (again)

Ok, I;'ve been struiggling to find the answers I'm looking for despite looking through a few tutorials.

-When pages are stored in a database, are they stored as just the content, no include command, no template, and when you use PHP to retrive the page, it displays with the template?

-Are only pages generally stored in database, not image etc.?

-Do I have to learn SQL to use a MySQL database, or is PHP sufficient?

Icespadez

Icespadez

Tech guy
Status: Offline!

Pages (files) aren't generally stored in a database. A database is used for storing bits of data. Say you had a list of 3 template files, you would store the name or path of the templates in the database, and not the templates themselves.

The ways that you can use PHP to retrieve this information is through database specific functions (ie mysql_connect) PHP needs to connect to the database and then send it a request, called a query. Querys are generally in a language called SQL. MySQL understands SQL. So, therefore you want to connect to MySQL using PHP's mysql functions, and then using the mysql_query function send it a query in SQL.

I hope this helps you understand the use of databases a bit better.

___________________

Site | Work | School | Microterra Networks

Natural_Cause

Natural_Cause

Status: Offline!

all it is is a table which has all ur collums with data types and rows of the infomation you insert. it stores all ur data, when u pull the info using php, cold fusion, asp etc. you tell the database what you want. such as

select * from products where producttype = camera

this select all the products with the type been camera then you can display them on the page and you might wanna order it by price decending

select * from pducts where producttype = camera
order by price desc

this pulls the info from the database in a format then when you display it on the page it will display it in the same order it comes from the database. so you need to know basic SQL to have more control over how you want to pull your content

___________________

http://whatpulse.bounceme.net/sig/naturalcause.png

BigToach

BigToach

Neversidian
Status: Offline!

all a database stores is data, alone a database is worthless. If you wanna think of how a database works look at a spread sheet. for the most part it is the same exact thing. bits of data are stored in rows and columns.

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Agatio

Agatio

Neversidian
Status: Offline!

ok, so a databse is used to MANAGE files, not STORE them?
Correct?
I still store my pages in folders on my server, but the database is a convenient way of organizing them?
And php is used to link and retrieve them, right?

BigToach

BigToach

Neversidian
Status: Offline!

all a database stores is data, alone a database is worthless. If you wanna think of how a database works look at a spread sheet. for the most part it is the same exact thing. bits of data are stored in rows and columns.

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Agatio

Agatio

Neversidian
Status: Offline!

???
Thats exactly what you posted before?
Care to answer my questions?
*points to motto*
"Help for those who really need it"
I need help....

Waldir

Waldir

God's Son
Status: Offline!

databese:

content = bla bla bla

your template:

header

include "content "

footer

___________________

"The secret to creativity is knowing how to hide your sources." -- Albert Einstein

Agatio

Agatio

Neversidian
Status: Offline!

??????????????
That made less sense than Big Toach's post(s)!

nano

nano

hello
Status: Offline!

Like BT said, a database is like a location where data can be stored. What's data? Data can be numbers, strings, any information.

A database is like a file folder. It is divided into tables. These are like spreadsheets (such as in Microsoft Excel). To begin using a database, you create a table. You decide names for the columns. Then, you can add rows to the table that describe, for example, items in a catalog. Every row you add will describe an item.

What Waldir is saying, perhaps very unclearly, is that you can use databases to store content for your pages. In such a situation, you would have a header and footer which would be the same on all your pages. The content would be different, and depending on which page is accesses by the user, the PHP script would take the content (such as a blob of text) out of the database and display it in the page, between the header and footer.

Databases are very organized because of their table structure, and their content can be modified on the fly from the PHP script. An alternative is to simply store content in actual files.

Quote:

I still store my pages in folders on my server, but the database is a convenient way of organizing them?
And php is used to link and retrieve them, right?


The filesystem is probably a much better way of storing your pages if you don't need fancy stuff like updating from user input (such as from user forms).

Actually it's rather a bad idea of storing PHP files in a database. To access them, you will first need a PHP script to open the database, retrieve the file, and then parse it. Instead of that, if the code you want to execute is in ordinary files like you have now, you can just use include() to parse them straight away.

Last edited by nano, November 12th, 2004 11:10 AM (Edited 1 times)

Page 1 out of 4
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0179 seconds.