0
1st - this code here prints random image from database. but i need help print random images but no repeating images.
2nd queestion is that how can i use this code to print image name. too.         




    $Q = "SELECT (SELECT image_short_name FROM user WHERE username = '$user') as `image_short_name`"
        .",`image_id`,`image`"
        ." FROM `image`"
        ." ORDER BY RAND()"
        ." LIMIT 30";
        $R = mysql_query($Q);

    while($row = mysql_fetch_assoc($R))
                                {
                                        $image_db = $row['image'];
                                        $src = "data:image/gif;base64," . $image_db;
                                        echo"<img src=\"$src\"  height='15%' width='15%' class='image_p' /> ";
                                }
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by JudgeyD
0

You could save the unique image id to an array or string, then check that array or string for the current unique image id, if it is not there, print the image.

Also, when you say image name, do you mean the file name or a name stored in the database?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.