My result is spitting out a duplicate of each record as opposed to a unique foreach match. As you can see I am trying to loop through and get each unique value WHERE $s=id.. I know the query needs to be within the while(),
The array $seminar being passed from checkboxes on my form.
if ($seminar) {
foreach ($seminar as $s)
$interest .= "$s ";
}
NOTE: The $interest is what I am using to insert into my table (it's not part of this problem)
For array data, this is what is being returned by $seminar
Array
(
[0] => 1
[1] => 8
[2] => 9
[3] => 10
[4] => 13
)
Here is my code:
$query_seminars = mysql_query("SELECT id, name, UNIX_TIMESTAMP(moment) FROM seminars WHERE id={$s}");
while ($sem_row = mysql_fetch_assoc($query_seminars))
{
$names .= "-- " . $sem_row['id'] . " " . $sem_row['name'] . date('D, F j, Y, g:i a', $sem_row['moment']) . "<br />";
}