Navigation with 'movenext' and Graphic-Buttons

Dear eXperts
I reading items from a normal db

....
strSqlStmt = "SELECT * FROM praeparate WHERE unterbegriff_ger='" & produktserie & "' AND publish = 'yes'"
etc.
....

and would like to navigate with the following 'rollover buttons' to the previous and next record using the 'rs.movenext and rs.moveback' options.

    <a href="previous_page.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image121','','images/back_dark.gif',1)">
    <img src="images/back_clear.gif"    alt="Previous" name="Image121" width="56" height="43" border="0" align="absmiddle" id="Image121"></a>
    <% =view_anzeige %><% =id %><% =view_von %><% =endzahl %>
       <a href="next_page.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image111','','images/forward_dark.gif',1)">
    <img src="images/forward_clear.gif" alt="Next" name="Image111" width="56" height="43" border="0" align="absmiddle" id="Image111"></a>

Thanks * B Rgds from Spain
Manfred
cosmopolitaWebmasterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peh803Commented:
okay, so what are you looking for?

Do you currently have a page that displays results from the "praeparate" table?  
How are you currently building that page?

peh803
0
cosmopolitaWebmasterAuthor Commented:
I have a page but I don't know how to make
the navigation buttons
http://gehwol-espana.com/view_products.asp

The page should stop just before the at the first <hr>
where the blue buttons are and wait for inputs (next or previous).

The rest are results from the
  if rs2.eof then
  response.write "<option value="""">Keine Gattungen in der Datenbank"
  else
  do until rs2.eof
 +++ here details are shown +++
  rs2.movenext
  loop
end if
0
peh803Commented:
okay, well the first thing is this:

How do you determine which record to display on your page?  I can see that you're displaying all of them right now, but eventually, you only want one per page, right?

So you'll have to do something like this:
<%

response.write "<a href=""view_products.asp?id=122"">click to view product 122</a>"
response.write "<a href=""view_products.asp?id=123"">click to view product 123</a>"

%>

etc.

Then, when you populate your rs2 recordset, you're probably doing something like this:
rs2.open SQL_Statement, connection

Instead of doing "SELECT * FROM Table" in your SQL Statement, it would be "SELECT * FROM Table WHERE ID="&request("id")

Now, you'd open the recordset for just that one record and your page would write the 1 record only.  

If you are currently viewing record #122, your previous and next buttons would look something like this:

<%
response.write "<a href=""view_products.asp?id=121"">previous</a>"
response.write "<a href=""view_products.asp?id=123"">next</a>"
%>

Regards,
peh803
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

cosmopolitaWebmasterAuthor Commented:
Yeah, but I would like to use the
rs.movenext .and. rs.moveback (if it's right) options.

There are some 100 items in the table now.
With the above:
strSqlStmt = "SELECT * FROM praeparate WHERE unterbegriff_ger='" & produktserie & "' AND publish = 'yes'"

22 are selected.

Bow, I would like to navigate between these 22
Your otion
<%
response.write "<a href=""view_products.asp?id=121"">previous</a>"
response.write "<a href=""view_products.asp?id=123"">next</a>"
%>
is not possible as the next item may not be one of the selected ones.
0
peh803Commented:
I understand this, but the problem is that you cannot access a server side recordset on the client.  That is, you have to repopulate your recordset before you do rs.movenext and rs.moveback, which means that you'd be at the beginning of the recordset.  

There are ways to handle the fact that the records aren't necessarily right next to each other (I can help you with SQL syntax to get previous and next ID's).  But, I'm afraid in order to move to the next item, you can't use a server side recordset.

peh803
0
cosmopolitaWebmasterAuthor Commented:
What about making a 'temp' table,
copy all the selected records there and
go from there ?
0
peh803Commented:
ugh -- no need for a temp table when you can do it all without a temp table...

All you need is:

1.) a SQL Statement to get your records
2.) a SQL Statement to get the previous record in your recordset based on the current ID
3.) a SQL Statement to get the next record in your recordset based on the current ID

peh803
0
cosmopolitaWebmasterAuthor Commented:
Okay BUT:
Let's say we have a tabke with the following records:
1 cars
2 bikes
3 cars
4 bikes
5 cars
and I only want to navigate (show) the cars.

Going to "next" would mean I go from 1 (cars) to 2 (bikes)

Not possible ?
0
peh803Commented:
if you only want to show cars, you have to have some way of specifying this in your select statement that gets the records out of your table!

And then, you'd have some rule that would say "Hey, if I only have 1 record in the recordset, I don't generate previous and next buttons that work."

Make sense?
peh803
0
cosmopolitaWebmasterAuthor Commented:
Ref.:
==
if you only want to show cars, you have to have some way of specifying this in your select statement that gets the records out of your table!

I know and that's done.
So, how van I navigate in between the cars back and forward ?
--------------------------------------------------------------------------
Ref.:
==
And then, you'd have some rule that would say "Hey, if I only have 1 record in the recordset, I don't generate previous and next buttons that work."

I know, but this comes later
0
cosmopolitaWebmasterAuthor Commented:
Dear peh803
I packed all items in different tables

Now, how to navigate
If I write:
strSqlStmt = "SELECT * FROM cars WHERE publish = 'yes' "
...
...
response.write "Car: " & rs("cars")

it only shows me the last one.

If possible pls give me the full lot.

Thanks + B Rgds
Manfred
0
peh803Commented:
Manfred:

Please post your table structure for the Cars table.  I should be able to provide a good example for you.

Thanks,
peh803
0
cosmopolitaWebmasterAuthor Commented:
I got it so far "I THINK" - Hold on :-))
0
peh803Commented:
ok, good!  I'll hold on as long as you like.. :)
0
cosmopolitaWebmasterAuthor Commented:
Sorry, I was late ...............
Was going to pay but if possible tell me:
When I make a query as follows:
SELECT ID, produktname_ger, text1_ger, text1_spa, text1_eng FROM pflegecremes WHERE (text1_ger LIKE '%kennedy%' ) or (text1_eng LIKE '%kennedy%' ) or (text1_spa LIKE '%kennedy%' )
it works.
And as soon as I make a UNION
SELECT ID, produktname_ger, text1_ger, text1_spa, text1_eng FROM pflegecremes UNION select ID, produktname_ger, text1_ger, text1_spa, text1_eng FROM gerlachpraeparate WHERE (text1_ger LIKE '%kennedy%' ) or (text1_eng LIKE '%kennedy%' ) or (text1_spa LIKE '%kennedy%' )
it shows me ALL records, even looking for a non existing search word like "Kennedy".
0
peh803Commented:
When you run this statement:

  SELECT
    ID,
    produktname_ger,
    text1_ger,
    text1_spa,
    text1_eng
  FROM
    pflegecremes  
    UNION
  select
    ID,
    produktname_ger,
    text1_ger,
    text1_spa,
    text1_eng
  FROM
    gerlachpraeparate
  WHERE
    (text1_ger LIKE '%kennedy%' ) or
    (text1_eng LIKE '%kennedy%' ) or
    (text1_spa LIKE '%kennedy%' )

this will select ALL records from pflegecremes and it will union these records with ONLY records in gerlachpraeparate where your criteria is met in your second statement.  If you want criteria to apply to both statements, you have to specify it in both places.  Like this:

  SELECT
    ID,
    produktname_ger,
    text1_ger,
    text1_spa,
    text1_eng
  FROM
    pflegecremes  
  WHERE
    (text1_ger LIKE '%kennedy%' ) or
    (text1_eng LIKE '%kennedy%' ) or
    (text1_spa LIKE '%kennedy%' )
    UNION
  select
    ID,
    produktname_ger,
    text1_ger,
    text1_spa,
    text1_eng
  FROM
    gerlachpraeparate
  WHERE
    (text1_ger LIKE '%kennedy%' ) or
    (text1_eng LIKE '%kennedy%' ) or
    (text1_spa LIKE '%kennedy%' )

Hope this helps!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cosmopolitaWebmasterAuthor Commented:
You are an angel :-))
B Rgds from the Costa del Sol (Spain)
Manfred
0
peh803Commented:
:-) glad to help!

peh803
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.