I have 5 tables. I need to select the 4 most recent posts from one table and get the ID for those posts in four separate variables to use for queries from the other tables:
SELECT userid FROM table1 WHERE subcategory = “$input” ORDER BY id DESC LIMIT 4;
So there I have what I need. Now how can I assign those four userid results to new variables to be used in future queries on that same page:
SELECT * FROM table2 WHERE userid = $userid1;
SELECT * FROM table2 WHERE userid = $userid2;
SELECT * FROM table2 WHERE userid = $userid3;
SELECT * FROM table2 WHERE userid = $userid4;