Linking PHP URL Parameters

November 5th, 2009

Quick note before you get confused: this tutorial is made for an intermediate web designer as it uses rather advanced code in its’ example. For more information on how to build dynamic content like this in Dreamweaver check out “Dreamweaver CS3: Beyond the Basics” series that you can find at http://bit.ly/O4NA.

Recently I came across a very unique problem when coding my portfolio page: all the pages where written in PHP using an URL parameter like example.php?nc=SHORTNAME (SHORTNAME is defined in the MYSQL table right after the primary key). This makes the page more memorable and bookmark-able. But there was still a problem: how do you create and forward and back link between the many SHORTNAMES? The solution was easier than I originally thought.

After much controlled anger about this problem, I came upon a revelation that I can use PHP to query the MYSQL database and not have it just spit out the information of the page it is on (as defined in page URL parameter) but also use it to call on the primary key (which is an auto incrementing number), add it by one, then again out of that row get the next SHORTNAME word and use it in a link. Problem Solved.

The code is:

Next page:

Previous page:


Leave a Reply