close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


dynamic data

Thread began 2/11/2015 1:14 pm by Kumel | Last modified 2/18/2015 1:56 pm by Kumel | 1241 views | 6 replies |


dynamic data

Site is about displaying artworks.
Tables are artwork & artist.
Artwork stores artist id to identify artist name & etc.

So for an example for demonstration i will use following data:
ARTIST TABLE id: 1,2,3,4,5,6 (only artist id)
ARTWORK TABLE id: 7,8,9,10 (artwork id)

So lets say i m on artwork.php where all 7,8,9,10 are displayed. when viewing one on artwork-details.php ex: id=7, then there are next & prev buttons which links to next artwork id or prev like id=8(next) or id=10(prev).

for next id a href is :

<a class="portfolio-next" href="artwork-details.php?id=<?php echo $totalRows_rsnextid == 0 ? $row_rsminmaxid['MinID']:(isset($_GET['id'])?$row_rsnextid['id']:1);?>">

for prev id a href is:

<a class="portfolio-prev" href="artwork-details.php?id=<?php echo $totalRows_rspreviousid == 0 ? $row_rsminmaxid['MaxID']:(isset($_GET['id'])?$row_rspreviousid['id']:1);?>">

so rsnextid, rsminmaxid, rspreviousid are:

$currentid_rsnextid = "-1";
if (isset($_GET['id'])) {
$currentid_rsnextid = $_GET['id'];
mysql_select_db($database_con1, $con1);
$query_rsnextid = sprintf("SELECT id FROM artworks WHERE id > %s ORDER BY id ASC LIMIT 1", GetSQLValueString($currentid_rsnextid, "int"));
$rsnextid = mysql_query($query_rsnextid, $con1) or die(mysql_error());
$row_rsnextid = mysql_fetch_assoc($rsnextid);
$totalRows_rsnextid = mysql_num_rows($rsnextid);

$currentid_rspreviousid = "-1";
if (isset($_GET['id'])) {
$currentid_rspreviousid = $_GET['id'];
mysql_select_db($database_con1, $con1);
$query_rspreviousid = sprintf("SELECT id FROM artworks WHERE id < %s ORDER BY id DESC LIMIT 1", GetSQLValueString($currentid_rsnextid, "int"));
$rspreviousid = mysql_query($query_rspreviousid, $con1) or die(mysql_error());
$row_rspreviousid = mysql_fetch_assoc($rspreviousid);
$totalRows_rspreviousid = mysql_num_rows($rspreviousid);

mysql_select_db($database_con1, $con1);
$query_rsminmaxid = "SELECT min(id) AS MinID, max(id) AS MaxID FROM artworks";
$rsminmaxid = mysql_query($query_rsminmaxid, $con1) or die(mysql_error());
$row_rsminmaxid = mysql_fetch_assoc($rsminmaxid);
$totalRows_rsminmaxid = mysql_num_rows($rsminmaxid);

Now as said artwork-detail page works fine, but i got a challenge at some other page.
ie artist-details.php

artist.php page displays all artists ie. ID= 1,2,3,4,5,6.

Now lets say i choose id=1 (Artist id) from artist.php page then his/her artworks linked are shown at artist-details.php (7,9,10 artwork id). then lets say person clicks on any artwork(artwork id 7) which view fine, now when clicking next or prev it take to direct next(artworkid=8 in which above example it must be 9) same with prev. so i m not sure how its done. i guess this can be helpful for me to next time use it for other things as well.

So how can this be made?
When viewing a artwork-details link is like : artwork-details.php?id=7
so i guess it must be like artwork-details.php?id=7?artistid=1
not sure how to do it.

Sign in to reply to this post

Jason ByrnesWebAssist

I don't follow what you are asking, I am very confused what it is you are trying to accomplish.

Sign in to reply to this post


1st i will explain the background.

currently there is an arists page where all artist are viewed. then when viewing artist details all artwork of that artist is shown in artist details page.

Now on artist detail page when i click any artwork it take me to artwork-detail.php page.

Now here there are two buttons
1- next artwork
2- previous artwork.

next take next artwork ex if i was checking artwork of id=7 then clicking next id=8 so it changes as per button click next or prev.
Is this clear so far?

Sign in to reply to this post

Jason ByrnesWebAssist


Sign in to reply to this post


so now lets say from artists.php i choose artist 1,
and i can see his artworks (lets call its artwork ids as: 7,9,10)

now when i click artword id 7, it take me to artwork-details.php?id=7
on clicking next button in artwork detail page, it must take me to next artwork of the same artist. ie: artwork-details.php?id=9.
and not 8.
artwork id 8 belongs to some other artist so.

How do we do that?

some changes required in a href?

Sign in to reply to this post

Jason ByrnesWebAssist

the artwork table should contain a column for the artist ID right?

pass the artist ID in the link:
artwork-details.php?id=7& artistID=1

then in the recordset for the next / previous link add a condition for the artist ID column:
WHERE id > currentid AND artistID = paramArtistID

Name: currentid
type: integer
default value: -1
Runtime value: $_GET['id']

name: paramArtistID
type: integer
default value: -1
Runtime value: $_GET['artistID']

Sign in to reply to this post


i m confused a lot. i think its ok.
Will try someother time.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...