Mysql problem creating linkeage between two tables in a third table

lo all, bit of a prblem here that I’m currently thinking about.

I have a cms I’m developing at the moment which will hopefully allow developers to assign different uniqely created variables to various template types within the cms. I’ve already create a “page” table which contains the main pages, with templates/types assigned to that page, and also already have a method for attaching variables to a certain template type.

Low level users of the cms are able to dynamically assign templates from the pre-defined library to whatever page they like at the moment, but my problem seems to be finding a way to assign linkeage for variables to pages.

I already have primary and foreign keys set up so that this linkeage can be facilitated, but my real problem is how to enable users to input variables on the fly.

Obviously if a developer comes along and creates new variables for a certain template there will need to be some creation of the variable link in the database, but I’m really wondering if there’s anyone out there who can point me in the right direction with regards to doing conditional logic within a mysql statement, since I’m on mediatemple here with only a 4.x install of mysql I can’t use any kind of stored procedure.

I would really love to do some kind of database call that will get back all of the required variable fields for editing regardless of whether or not there is an entry in the database or not, sort of like some kind of loose join that doesn’t mind if an entry exists or not, but simply returns empty and full listings. Sort of like a conditional select/update/insert statement, if that doesn’t sound too insane… :lol:

Please post if this makes no sense, as someone may be able to help with some clarification.

lol