Yay, another question, and most likely an easy one to answer. I am trying to make my thingy easier to make changes to in the future and because I am currently doing things in a retarded manner I want to change things.
I currently have a few separate pages/files to show entries in certain ways
full.php - standard single entry based on id
full5.php - as above but 5 entries
fullc.php - pulls single entry based on code
fullr.php - pulls single entry based on lab book ref
I realise this is very much the wrong way to do things, hence why I want to change it.
I currently decide things things based on using $_GET
.....php?id=xxx
.....php?code=ATxxx
.....php?ref=ATrxxx
I have easily got rid of the one to pull 5 entries so that's not a problem. I want to now combine all the others so I can for example use any of these:
full.php?id=xxx
full.php?code=ATxxx
full.php?ref=ATrxxx
I use these to get the values:
$tableid = $_GET['id'];
$tablecode = $_GET['code'];
$ref = $_GET['ref'];
But how do I now tell it to fetch the record based on which is actually present?
There will only ever be one of those there at any one time. I assume using some sort of if else null statements would sort it but I'm not sure how to go about it. |