Вопрос

Hey this is probably really simple, but i am still a beginner i am a bit confused about that.. I want to create something like a selfmade CMS for my website.

I have a .php document which is querying certain data from my database. Now if i change that data, the document will display the new data. (So i can edit my texts and images..)

My actual question is, how can i create something like a new page. So that i have a form which will write new data into my database and the .php document somehow displays my new data. I mean it is the same "template" like my first .php document, but how can i query different things from my database than before? How does that work in real CMS systems?

Basically i want to write new data in my database with a form. And depending on which url i will click in my index.php, different data is shown in my page1.php document.

I hope you know what i mean. Thank you

EDIT:

To give you an example: A main document with a lot of url's named "data1" "data2" "data3" and so on. If i click on "data2" the showdata.php document should display the data2 which it will find in the database.

Это было полезно?

Решение

Have you tried using the data in the url to write different queries ?

Something like:

if (data1) {select data1 from database} elseif(data2){select data2 from database}

and so on ? This is what a CMS does actually it, shows different data on the same page based on the url parameters which in php you can use as $_GET['data1'] or $_REQUEST['data1']

Try something like that then update your answer with some code.

Другие советы

I assume that you're interested in a thing called a CRUD application.

CRUD stands for Create, Read, Update, Delete application.

There are numerous examples of CRUD applications in PHP/MySQL all over the internet.

checkout this link: http://thewebmason.com/php-mysql-crud-tutorial-using-pdo-create-read-update-delete-part-1-create/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top