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
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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.