Jump to content

Multiple Pages (MySQL Too!)


jege

Recommended Posts

Hello.

 

I'm coding myself an small webpage, In the internet you can see that there is pages like index.php?id=223923 <- for example or index.php?=news.

So, I'm trying to create similar to that myself. I tried googling and searching youtube how to do this but didn't really find anything.

 

I figured it out that it needs some database etc.

 

I tried myself doing some table in my mysql db. And in the table some 'id, title, content' and in the id would be the url, (index.php?='id') the title would be the <title> </title> and the content would be all the code inside the webpage. I got no idea how to link these to an php or whatever it should be done :D So would anyone kindly tell me howto do this or give some link to an tutorial? :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/254412-multiple-pages-mysql-too/
Share on other sites

Hello.

 

I'm coding myself an small webpage, In the internet you can see that there is pages like index.php?id=223923 <- for example or index.php?=news.

So, I'm trying to create similar to that myself. I tried googling and searching youtube how to do this but didn't really find anything.

 

I figured it out that it needs some database etc.

 

I tried myself doing some table in my mysql db. And in the table some 'id, title, content' and in the id would be the url, (index.php?='id') the title would be the <title> </title> and the content would be all the code inside the webpage. I got no idea how to link these to an php or whatever it should be done :D So would anyone kindly tell me howto do this or give some link to an tutorial? :)

 

 

if you are storing html inside of your database, don't. To get started, you don't even need a database, whatever is after the ? in a url is called the query string, and contains values to be sent to that page and used with a server side coding language. You might want to start by viewing some basic tutorials on PHP. You can google for this or go to http://php.net/manual/en/tutorial.php which has quite a few good tuts on it.

When I clicked your link it just gave an webpage with 1 tutorial or so. Ill try it again ;)

it involves some navigation on your part, but i'll post the other tut.

http://www.php.net/manual/en/langref.php

really, not tuts, informative documentation rather.

 

Thanks for your help :)

 

I managed to do what I wanted with this:

 

if($_GET['site']=='news'){
require ('news.php');
}elseif($_GET['site']=='info'){
require ('info.php');
}elseif($_GET['site']=='location'){
require ('location.php');
}else{
       require('index.php');
}

 

I guess there is more ways to do this but this worked for me really easily :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.