I working in a poll script, i have two tables {hs_questions_q}{hs_answers_ans} the first one stored the question and the second stored its answers
i used this sql statement to retrieve the data
SELECT * FROM hs_questions_q INNER JOIN hs_answers_ans ON id_q=idq_ans WHERE active_q ='1' and home_q ='1' ORDER BY id_q DESC limit 1
what i was wonder and i can’t deal with in my php code is how that this query returned the last row only from the the question table and answers table, but i need to retrieve the last row from the question table and all rows related to it from the answers table
This will return 1 row per question in the table not as the num rows of answers:
I assume the structure:
hs_questions_q (id,desc)hs_answers_ans(id,desc)Later, you can split it by ‘#’ after retrieving the result on the php side.
You might get truncated answers if it exceeds the allowed packet size. You can solve it by,