I am trying to get the content from the database depending on the url. Lets say that you are on index.php then I want to get the content from the database with the entity page. My database looks like this:
|id | page | header | content | feature | footer |
|01 |index | header | content | feature | footer |
It is not the whole as it is a project that I can't show all of it, so I put in just dummy data in it here.
The config.php:
<?php
$url = $_SERVER['REQUEST_URI'];
$dbhost = "dummyhost";
$dbuser = "dummyuser";
$dbpass = "";
$dbname = "dummy";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if(!$conn){
die("ERROR");
}
$index = mysqli_query($conn, "SELECT FROM pages WHERE page LIKE '".$url."%');
$indexRow = mysqli_fetch_assoc($index);
$indexHeader = $indexRow['header'];
$indexContent = $indexRow['content'];
$indexFooter = $indexRow['footer'];
$indexfeature = $indexRow['feature'];
How can I do it? I know that I can use $_GET to get some variables from the adress, but in this case I am not using any variables to go to another site. Can I still use that or am I on the right track?