| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> question about a search
I'm creating PSP pages.
I have a page where a user can enter a search term, and two radio buttons to select whether they would like to search the name field, or the description field.
So, I created a cursor like this:
<%!cursor game_cursor is
select *
from video_game
where search_area LIKE '%&search_terms%';%>
I have these parameters:
<%_at_plsql parameter="search_terms" default="null"%> <%_at_plsql parameter="search_area" default="null"%>
search_terms is the text box from the page where the user types what they would like to search for
search_area refers to the field in the database they would like to search: name or description
But when I use a for loop to run this cursor, nothing seems to happen:
for game_row in game_cursor loop
--if game_cursor%rowcount = 0 then%>
</p>
<p align="center">Your search returned no results.</p>
<%
--else
%>
<p align="center">Your search returned the following results:</p>
<%=game_row.Name%>
<%
--end if;
%>
it's looping
<%
end loop;
%>
it appears to skip over the loop altogether. I think this is because the system seems to think that 'search_area' or 'search_terms,' which are part of the cursor, are actual fields, when they are not. I want them to be placeholders or variables which can change.
so, my sql would like this if the user searched the name field for 'mvp baseball':
select *
from video_game
where Name LIKE '%MVP Baseball%'
And the user should be able to search the name or description field depending on what they choose.
Thanks for any help.
Matt Received on Mon Apr 26 2004 - 18:00:01 CDT
![]() |
![]() |