I'm making a photo album with my own CMS, part of it is adding photoalbums to it, but i'm having some trouble linking the "click on album name" to the loading of the correct photo album.
my 2 tables are gallery_categories, primary key: id
and gallery_assests, primary key: cat_id
What i need to do is when i click on a link, cat_id and id match so it loads the correct images.
Currently it only takes the last item in my $row array and puts it into the $check and gives it to the other SQL qry.
<?php
$connection = mysqli_connect('localhost','xxxx','xxxx','xxxx');
$sql= "SELECT title,id FROM gallery_categories ORDER BY order_id ASC";
$result = mysqli_query($connection,$sql);
while ($row = mysqli_fetch_array($result)) {
$title = $row['title'];
$id = $row['id'];
?>
<li><a href="<?php $check=$id; ?>"><p id='opmaak'><?php echo $title; echo $check; ?></a></p></a></li><?php
}
mysqli_close($connection);
?>
</ul>
</div>
<div id="main_image"></div>
<ul class="gallery_demo_unstyled">
<?php
$connection = mysqli_connect('localhost','xxxx','xxxx','xxxx');
$sql= "SELECT cat_id, thumbnail, caption FROM gallery_assets WHERE cat_id=$check ORDER BY order_num ASC";
...
Thanks in advance