I'm new on php
and mysql
. I found several things that I can use - such as implode- on internet but I couldn't make it. I will try to be clear as much as I can.
First table name: mylist
column name: id
(The values on this column are unique.) (incremental)
I put all ids inside an array called myIds
. The array contains only unique integer values and it's length is 800.
I need to get answers for each ids from another table for the current date. This table also contain id
column but for an id
, there can be more than one answer.
For example: today, there are 3 answers for id 1 and 5 answers for id 4, etc.
Second table name: answerlist
This is the query works for a specified id:
$sql = "SELECT `answer` FROM `answerlist` WHERE `type`= 'Help' AND `id` = 1 AND DATE(`added`) = DATE (NOW())";
I would like to create a dynamic query which gets id values from the above array. How can I do this?