While Loop and Showing Images from a Folder With SQL
<p>I have a list of images within a file. The file name along with details about the image are stored in a mysql table. I have created a while loop that randomly generates several images on my page. There is a problem however. My webpage is not producing any images. I have narrowed it down to the function I created clothing_data. I'm just stumped at what I need to do. Here is the code below.</p>

<pre><code>&lt;?php
function clothing_data ($id) {
    $data = array();
    $id = (int)$id; 
    $func_num_args = func_num_args();
    $func_get_args = func_get_args();   
    if ($func_num_args &gt; 1) {   
        unset($func_get_args[0]);
        $fields ='`' .  implode ('`, `', $func_get_args) . '`';
        $data = mysql_fetch_assoc (mysql_query("SELECT $fields FROM `dress` WHERE `primary_id` = $id"));
    return $data;
    }
}

$num_dresses = dress_count ();

$i = 0;    
while ($i &lt; 5)
{   
    $rand_id = rand(1, $num_dresses);
    $dress_feed_data = clothing_data($rand_id, 'file_name', 'user_defined_name', 
'user_defined_place' , 'user_who_uploaded');
    echo $dress_feed_data['file_name'];
    if (file_exists('fashion_images/' . $dress_feed_data['file_name']))
    {
?&gt;

&lt;br&gt;
&lt;img src="fashion_images/&lt;?php echo $dress_feed_data['file_name'];?&gt;" width="50" height="50" /&gt;
&lt;?php
    }
    $i++;
}
?&gt;
</code></pre>
