0

I am currently using WordPress with SEO friendly permalinks. One page of my website is a special one though, let's call it http://example.org/locales. It is using a custom page template that loads values from a database table called "locales" and echoes the content to a html table.

Database columns:

id, location, address, type, guid

Example content:

3, Yale, Burberry street 21, Apartment, 40VIEOUKK2VA07F2

I have currently configured my PHP code in the custom page template so that the location column contains a link to the guid for each item like this:

echo "<td><a href=\"?guid=" . $row['guid'] . "\">" . $row['address'] . "</a></td>";

This gives me a link that looks like this:

http://example.org/locales/?guid=40VIEOUKK2VA07F2

Now I have two questions:

  1. How do I proceed to actually load the details from a locale with a specific guid if they are stored in a different database table?
  2. How do I make an URL rewrite for /?guid=40VIEOUKK2VA07F2 so that it becomes something like http://example.org/locales/burberry-street-21 ?
  • Please consider splitting this into two specific questions, it is challenging to provide good answer to a two entirely different things at the same time. Also both querying database and rewrites are extensively covered around, some research effort might be in order. :) – Rarst Nov 22 '13 at 10:23
0
  1. Just because it is under wordpress doesn't make this special in any way, just use any php sample code that connects and retrieves data from a DB.

  2. The way you describe things it is impossible. If the DB is outside of WordPress how can wordress know that burberry-street-21 should be converted to 40VIEOUKK2VA07F2 before accessing the external DB?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.