I have a series of fields:
Cat1
SubCat1
Cat2
SubCat2
Cat3
SubCat3
etc. up to 5.
I want to SELECT from the database where $cat and $subcat match a pair above (but they must be the same number, not Cat1 and SubCat2 for example).
Before I added the extra cats, I had:
SELECT FROM sites WHERE Cat = '$cat' AND SubCat = '$subcat'
And I've tried loops and everything, but I'd really prefer to return them all in one go, because I run all sorts of stuff on the results and don't want to have to do it 5 times.
I've tried
SELECT FROM sites WHERE Cat1 = '$cat' AND SubCat1 = '$subcat' OR WHERE Cat2 = '$cat' AND SubCat2 = '$subcat'
but that doesn't seem to return anything at all.
Hope you can help, it's quite urgent, so I'd really appreciate any help.
Thanks in advance,
Danny
Cat1
SubCat1
Cat2
SubCat2
Cat3
SubCat3
etc. up to 5.
I want to SELECT from the database where $cat and $subcat match a pair above (but they must be the same number, not Cat1 and SubCat2 for example).
Before I added the extra cats, I had:
SELECT FROM sites WHERE Cat = '$cat' AND SubCat = '$subcat'
And I've tried loops and everything, but I'd really prefer to return them all in one go, because I run all sorts of stuff on the results and don't want to have to do it 5 times.
I've tried
SELECT FROM sites WHERE Cat1 = '$cat' AND SubCat1 = '$subcat' OR WHERE Cat2 = '$cat' AND SubCat2 = '$subcat'
but that doesn't seem to return anything at all.
Hope you can help, it's quite urgent, so I'd really appreciate any help.
Thanks in advance,
Danny