title: How select rows from database mysql with foreach?
body: <p>For ex. adress page test.php?prid=4477535</p>
  
  <p><strong>Code page test.php</strong></p>
  
  <pre><code>function query($query) {
      $database = 'test';
      $host = 'test';
      $username = 'test';
      $password = 'test';
      $link = mysql_connect($host,$username,$password);
      if (!$link) {
      die(mysql_error());
      }
      $db_selected = mysql_select_db($database);
      if (!$db_selected) {
      die(mysql_error());
      }
      $result = mysql_query($query);
      mysql_close($link);
      return $result;
      }
  
  
          $product_idn=$_GET['prid'];
  
          $select_image = query("SELECT * FROM products_images WHERE `product_idn`='$product_idn'") or die(mysql_error());
          foreach ($select_image as $row)
          {
          $select_image_array[]=$row-&gt;image;
          }
  
  print_r ($select_image_array);
  </code></pre>
  
  <p><strong>receives a request</strong></p>
  
  <pre><code>SELECT * 
  FROM products_images
  WHERE  `product_idn` =  '4477535'
  </code></pre>
  
  <p>If make select from phpmyadmin i have 10 rows.</p>
  
  <p>But if i use <strong>test.php?prid=4477535</strong> i see empty page.</p>
  
  <p><strong>print_r ($select_image_array) not show array.</strong></p>
  
  <p>Tell me please why  i see rows with phpmyadmin and not see rows with script?</p>