multiple image display issue

I have a profile page and 2 database tables

table1 users

table2 images

the issue is that it will echo out the account profile pic and information for each image. the image gallery for that user should show up under the users profile picture… this is a live view of what I am trying to accomplish. http://bodyelectrictattoo.com/our-team/

but I have been unsuccessful.

everytime the user adds a image it repeats the users profile pic and info… I need for that users gallery to show under there profile pic.

[php]

<?php $db = dbconnect(); $stmt = $db->prepare('SELECT users.email, users.full_name, users.job_title, users.bio, users.profile_photo, images.id, images.artist_img FROM users INNER JOIN images ON users.id=images.id ORDER BY images.id ASC'); $stmt->execute(); $result = $stmt->get_result(); while (($row = mysqli_fetch_assoc($result)) != false) { $id = $row['id']; $full_name = $row['full_name']; $email = $row['email']; $job_title = $row['job_title']; $bio = $row['bio']; $ProfilePhoto = $row['profile_photo']; $artist_img = $row['artist_img']; if (isset($ProfilePhoto) && ! empty($ProfilePhoto)) { $image = "$ProfilePhoto"; } else { $image = "avatar.jpg"; } echo "
$full_name
$job_title

$bio

Contact Me
"; echo" \"\""; echo "

"; } ?>

[/php]

Don’t create variables for nothing. This line is redundant

while (($row = mysqli_fetch_assoc($result)) != false)

WHILE will only execute as long as the condition is true. Should be

while ($row = mysqli_fetch_assoc($result)

Per the manual

The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE.

http://php.net/manual/en/control-structures.while.php

Sponsor our Newsletter | Privacy Policy | Terms of Service