Jump to content

foreach($bla as $blb) { mysqli_query() }


SeanHarding

Recommended Posts

I have an array with 3 id's in it...

 

currently i'm doing the following:

$my_array(2, 4, 6);
foreach ($my_array as $search) {
  $quer = "SELECT * FROM my_table WHERE id=$search LIMIT 1";
  $run = mysqli_query($connect, $quer);
  while ($new_array = mysqli_fetch_array($run)) {
   //displaying results here
  }
}

 

Is there a better way of doing this instead of repeating my query?

Am I in the wrong forum?

 

Link to comment
https://forums.phpfreaks.com/topic/130873-foreachbla-as-blb-mysqli_query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.