This is frustrating me and I could use some help if you wouldn't mind - Below the While Loop I'm trying to add the //Get Images Tied To Vent block - and it breaks the whole script. I'm trying to have the script fetch each image that is located in the uploads WHERE the confessId matches ( hence why I placed it in the loop aswell ) other wise I don't have access to the confessId.
Each image is stored in the uploads tied to the confessId so I'm simply trying to fetch each image that matches the Id and display them above the <i class="fa fa-quote-left"></i>
<div class="confessbox">
<?php
while ($row = mysqli_fetch_assoc($res)) {
//Get Imgaes Tied To Vent
$getImg = "SELECT * FROM uploads WHERE confessId = ".$row['confessId']."";
$imgSql = mysqli_query($mysqli, $getImg) or die(mysqli_error());
$imgFetch = mysqli_fetch_array($imgSql) or die(mysqli_error());
// Get Total Comments
$comssql = "SELECT 'X' FROM comments WHERE confessId = ".$row['confessId']." AND isActive = 1";
$commentstotal = mysqli_query($mysqli, $comssql) or die('-4'.mysqli_error());
$totComments = mysqli_num_rows($commentstotal);
if ($totComments == '1') { $comText = 'Comment'; } else { $comText = 'Comments'; }
if ($row['totalViews'] == '1') { $viewText = 'View'; } else { $viewText = 'Views'; }
$shareURL = $set['installUrl'].'page.php?page=view&confession='.$row['confessId'];
?>
<div class="confession confHide">
<p>
<img src="/uploads/<? echo $imgSrc; ?>">
<i class="fa fa-quote-left"></i>
<?php
if ($filterProfanity == '1') {
echo nl2br(htmlspecialchars(filterwords($row['confessText'])));
} else {
echo nl2br(htmlspecialchars($row['confessText']));
}
?>
<i class="fa fa-quote-right"></i>
</p>
<input type="hidden" id="confessId" name="confessId_<?php echo $count; ?>" value="<?php echo $row['confessId']; ?>" />
<div class="confession-footer">
<div class="likes">
<span class="label label-confess first liked">
<a href="" id="likeIt<?php echo $row['confessId']; ?>" class="likeIt_<?php echo $count; ?> text-success">
<i class="fa fa-smile-o"></i> <span id="likesVal_<?php echo $count; ?>"><?php echo $row['totalLikes']; ?></span>
</a>
</span>
</div>
<div class="dislikes">
<span class="label label-confess disliked">
<a href="" id="dislikeIt<?php echo $row['confessId']; ?>" class="dislike_<?php echo $count; ?> text-danger">
<span id="dislikesVal_<?php echo $count; ?>"><?php echo $row['totalDislikes']; ?></span> <i class="fa fa-frown-o"></i>
</a>
</span>
</div>
<span class="label label-confess"><?php echo timeago($row['postDate']); ?></span>
<?php if ($row['hasImage'] != '0') { ?>
<span class="label label-confess"><i class="fa fa-picture-o img"></i></span>
<?php } ?>
<span class="label label-confess last"><?php echo $row['totalViews'].' '.$viewText; ?></span>
<span class="label label-confess last hasVoted text-danger"><strong><?php echo $onlyVoteOnceText; ?></strong></span>
<div class="comments">
<a href="https://twitter.com/intent/tweet?text=<?php echo $set['siteName']; ?>%20Confession:%20<?php echo ellipsis($row['confessText'],65); ?>%20&url=<?php echo $shareURL; ?>" class="btn btn-tw btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $twitterShareTooltip; ?>">
<i class="fa fa-twitter"></i>
</a>
<a href="https://plus.google.com/share?url=<?php echo $pageURL; ?>" class="btn btn-gp btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $googleShareTooltip; ?>">
<i class="fa fa-google-plus"></i>
</a>
<a href="page.php?page=view&confession=<?php echo $row['confessId']; ?>" class="btn btn-comment btn-sm btn-icon">
<i class="fa fa-comments"></i> <?php echo $totComments.' '.$comText; ?>
</a>
</div>
</div>
<div class="clearfix"></div>
</div>
<?php
$count++;
}
?>
</div>
index.php