$sql_img="select * from tb_file where ref_id ='$id' and ref_file='product' order by id_file desc";
$result_img=mysql_db_query($dbname,$sql_img);
$num_rows=mysql_num_rows($result_img);
while ($record_img=mysql_fetch_array($result_img)){
$id_file=$record_img[id_file];
$name_file_b=$record_img[name_file];
$file_type=$record_img[file_type];
$ref_id=$record_img[ref_id];
$ref_file=$record_img[ref_file];
}