Jump to content

Rewriting URLS using MySql Database as Variables


mcc_22ri

Recommended Posts

 

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

 

<?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;


?>

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.