dimanche 12 juillet 2015

how to fix error with mysql random

I have project in php + mysql (over 2 000 000 rows). Please view this php code.

<?php 
            for($i=0;$i<20;$i++)
            {
                $start = rand(1,19980);
                $select_images_url_q = "SELECT * FROM photo_gen WHERE folder='$folder' LIMIT $start,2 ";
                $result_select = (mysql_query($select_images_url_q));
                while($row = mysql_fetch_array($result_select))
                    {
                    echo '<li class="col-lg-2 col-md-3 col-sm-3 col-xs-4" style="height:150px">
                                      <img class="img-responsive" src="http://static.gif.plus/'.$folder.'/'.$row['code'].'_s.gif">
                                </li>';
                }
            }
            ?>

This code work very slowly in $start = rand(1,19980); position, Please help how I can make select request with mysql random function, thank you




Aucun commentaire:

Enregistrer un commentaire