So I have the following query:
$resclients=$mysqli->query("SELECT id,client_name FROM clients WHERE id IN ($result[])");
And I am wondering, is it bad practice to execute the above query in a for or foreach-loop, does it hurt the MySQL server?
Or, is it better to do LEFT JOINS or INNER JOINS or RIGHT JOINS?
Forgot to add, the $result[] is actually a two dimensional array.
Show your array:
Array
(
[0] => Array
(
[id] => 7
[resclients] => 6,7,8,9,10,11,12,13,14,15
)
[1] => Array
(
[id] => 5
[resclients] => 5
)
[2] => Array
(
[id] => 4
[resclients] => 4
)
)
Just a small portion of it.