I want to convert my URLs into two parts e.g I have 4 urls like
- c/category1
- c/category2
- p/page1
- p/page2
Now what I extractly want is to convert URLs into two parts e.g.
$veriable_name1 = c
$veriable_name2 = category 1
or
$veriable_name1 = c
$veriable_name2 = category 2
or
$veriable_name1 = p
$veriable_name2 = page 1
or
$veriable_name1 = p
$veriable_name2 = page 2
In above examples C determines category and P determines Page. As i followed a tutorial to convert PHP urls into SEO friendly urls with PHP, but they only gave an example to convert urls by using PHP/MySQL from single table.
The code which i followed:
<?php
include('db.php');
if ($_GET['url']) {
$url = mysql_real_escape_string($_GET['url']);
$url = $url.'.html'; //Friendly URL
$sql = mysql_query("select title,body from blog where url='$url'");
$count = mysql_num_rows($sql);
$row = mysql_fetch_array($sql);
$title = $row['title'];
$body = $row['body'];
} else {
echo '404 Page.';
} ?>
HTML Part
<body>
<?php
if ($count) {
echo "<h1>$title</h1><div class='body'>$body</div>";
} else {
echo "<h1>404 Page.</h1>";
} ?>
</body>
but i have multiple links on my page and want to extract from multiple tables if other best suggestions