Hi there,
Here's the problem - I've got a series of tables (table1, table2, table3, table4) that store data entered for 4 independent data sets. To possible make things easier, imagine table1-table4 each being the vehicle models for 4 separate vehicle manufacturers.
Now, my problem arises when I go through this loop and output the data using the implode function. If it pulled data from table1 and table2, the data from table1 might, on its own, appear as
535i, 550i, M3, Z8
and the table2 data might be
911S, 911 Turbo, GT3, Boxster S
. However, when using the implode function as I have done, they are combined and appear as
535i, 550i, M3, Z8911S, 911 Turbo, GT3, Boxster S
Notice how there is no comma between Z8 and 911S. How do I add fix this?
foreach (array(1, 2, 3, 4)as $counter_value) {
if($row['id']==$counter_value){
$end_digit=$row['id'];
$_name="table".$end_digit."[]";
$table_name = "table";
$table_name .= $end_digit;
$sql="………
……
"
$result = mysqli_query($connection, $sql) or die(mysql_error());
while($row = mysqli_fetch_array($result_spec,MYSQLI_BOTH))
{
$arrayspec[] = $row_spec['name'];
}
echo implode(", ",$arrayspec);
}
unset($row_spec, $arrayspec);
}