I have two table:
Table Post:
    id              cateid            content
   ####             ######        ###############
    14                35           Lorem isplum
Category table:
    id              name
   ####          #########
    35              Sport
I usually using method to get all post from category like this:
$itemSport = array();
$itemSport = getAllPostFromSportCate(35);
with 35 is values of table.
Problem is:
- When I delete values - 35from- Categorytable. I can't- getAllPostFromSportCate($id)because- Categorytable not exist this values.
- I don't want insert values like - 35to function- getAllPostFromSportCate($id). If user change- idof- Categorytable. All logic will fail.
Problem 2:
I don't want pass values like 35.
Normal, I receive values when user click button.
Like:
select * from Post where cateid = (select id from Category)
or
select * from Post where cateid = $_POST('idCate')
 
     
     
     
    