Rewriting URLS using MySql Database as Variables
Posted: Thu May 24, 2012 2:16 pm
Hi,
I'm trying to use certain keywords/phrases from my mysql database and taking that information and using it in my urls/meta tags.
These are the steps I've already done.
1. I've connected to my database
2. I've declared the variables
3. I tested the variables in a sentece to see if they were working. It seems they are. See links below.
http://whatsmyowncarworth.com/auto/table.php (this is my data that I'm playing with)
http://whatsmyowncarworth.com/auto/urls.php (this is variables that are working. I create a $city and $state variable)
For me this is where the confusion starts to come into play ....
Here's my question. What do I need to do next? Do I need to write a script or something along those links to create my URLS? what would that script look like? Does it have to be a different page?
Thanks for everyones help!
Below is the code for my website so far.
http://whatsmyowncarworth.com/auto/urls.php
I'm trying to use certain keywords/phrases from my mysql database and taking that information and using it in my urls/meta tags.
These are the steps I've already done.
1. I've connected to my database
2. I've declared the variables
3. I tested the variables in a sentece to see if they were working. It seems they are. See links below.
http://whatsmyowncarworth.com/auto/table.php (this is my data that I'm playing with)
http://whatsmyowncarworth.com/auto/urls.php (this is variables that are working. I create a $city and $state variable)
For me this is where the confusion starts to come into play ....
Here's my question. What do I need to do next? Do I need to write a script or something along those links to create my URLS? what would that script look like? Does it have to be a different page?
Thanks for everyones help!
Below is the code for my website so far.
http://whatsmyowncarworth.com/auto/urls.php
Code: Select all
<?php
include('init.php');
$sql = "SELECT State, City FROM cars";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$state = $row['State'];
$city = $row['City'];
echo 'Hi, I\'m from '. $state . '. I live in the city of '. $city;
?>