Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: question about a search

Re: question about a search

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Fri, 30 Apr 2004 14:05:53 +0200
Message-ID: <c6tf8p$oda$1@news4.tilbu1.nb.home.nl>


Matt wrote:

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

--if is a comment (-- or /* with */) Maybe that's your problem?

-- 

Regards,
Frank van Bortel
Received on Fri Apr 30 2004 - 07:05:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US