Hi all,
I have a query which retrieves information from 2 tables. My WHERE statement receives its value from a URL on another page:
WHERE fname = ‘$name’ ";
Instead of using a primary key (e.g., name_id = 1) in my query and URL, I’ve used another column’s name – fname, in order to make the URL easier to read. The problem however, is that by using a column that’s not a primary key, I’m unable to a access the specific rows in my “child” table (primary - foreign key relationship).
So, should I rather use 2 key-value pairs in my query and URL, instead of what I’m currently doing?
WHERE fname = ‘$name’ && name_id=‘$nameid’”;
Or is there a simpler way or perhaps I’m missing something?
Please let me know.
Thanks in advance!