Retrieving values from mysql table based on current page

Hi,

I have a travel guide website which I have created with WordPress which contains destination guides. On the destination guides pages I have a sidebar which displays destination statistics (currency, time zone etc). Currently I have to create a new sidebar for each page each time changing these values. Is it possible to create a MySQL database with these values and then insert some php code that will identify what country page is loaded and insert the corresponding values so that I can use a single sidebar for all pages. I am fairly proficient with html/css but my understanding of php is limited. Any advice as to how this is best achieved would be greatly appreciated.

Thanks
Jack

The short answer is yes, this is essentially the whole point of dynamic, database connected web sites. However, the “how to” goes a bit beyond the scope of what can be dealt with in a forum post.

I would create a table containing destinations and another with the related info. In fact I’d probably create a single dynamic page and store everything for each destination in the database, then display all the relevant information for each destination from the database.

You say your understanding of php is limited, how limited? Do you know how to create a database with related tables etc. and how to connect to it and retrieve data from it?

Hi xerxes,

Thanks for your reply.
It seems I was trying to over-complicate the matter. Fortunately I have managed to resolve the issue using the WordPress custom fields function.

Jack

Sponsor our Newsletter | Privacy Policy | Terms of Service