0

hi all im trying to place this piece of coding in a table that i iam echoing if anyone has any ideas as been trying for last god knows how long

$fetch_img1 = mysqli_fetch_array(mysqli_query($conn,"select user_image from user_images where user_id = '".$show_id."' and main_image = '1' "));
              $show_image   = $fetch_img1['user_image'];
              ?>
          <div class="box">
            <?php if($show_image != '') { ?>
            <a href="viewprofile.php?profid=<?php echo $show_id;?>&gen=<?php echo $show_gender;?>"><img src="images/user_images/smallthumb/<?php echo $show_image;?>" border="0" width="100" height="80"/></a>
            <?php } else { ?>
            <a href="viewprofile.php?profid=<?php echo $show_id;?>&gen=<?php echo $show_gender;?>"><img src="images/blank.jpg" border="0" width="100" height="80" /></a>
            <?php } ?>
          </div>

And here is the table im attempting to place it in

<table border="1" width="600">
<?php
if (mysqli_num_rows($result) > 0) {

    // output data of each row

    while($row = mysqli_fetch_assoc($result)) {
    echo '<tr>';
    }
    echo '<td colspan="2" style="">' .ucfirst($fetch_user['user_name']). ',' . ($fetch_meets['event_ltm']). '</td>';
echo '</tr>';
echo '<tr>';
echo '<td style="width: 64px; height: 64px; text-align: center">photo goes here</td>';
echo '<td width="80%"></td>';
echo '</tr>';             
}
 else {
    echo "0 results";
}

?>

</table>

Many thanx jan x

3
Contributors
2
Replies
37
Views
5 Months
Discussion Span
Last Post by diafol
0

You should probably use only one sql statement.
eg:

SELECT id, firstname, surname, (select user_image from user_images where user_id=id and main_image = '1' LIMIT 1) as user_image From user_table...

So the image then comes back with the original dataset

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.