so what i do to print all numbers like this
Insert a break to the HTML code, e.g., <br />.
But I don't agree that it would be that different to build the statement manually or prepare and reuse a statement. The difference is that you have to build the values first with my way, you build the statement first with your.
It is not a big difference, but it does seem to me that this should be one place where prepared statements would shine more than as a safer escaping feature (which is not all that safe after all for emulated prepared statements, if I remember correctly).
Incidentally, I think you intended to write:
$ins = "";
foreach ($array as $value) {
$ins .= "( $value ),";
}
$ins = substr($ins, 0, -1);
But it probably is even simpler as:
$ins = '( ' . implode(' ),( ', $array) . ' )';