close ad
 
Important WebAssist Announcement
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 | 1626 views | 6 replies

Kumel

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.

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

Content

rating

Layout

rating

Ease of use

rating

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...