When I do a search for Author, Keyword, or Title
and I leave a search box blank, the search is returning ALL records in the
database:

I only want it to return records from fields that match with the search
criteria.

I exported the database from MSAccess (with ALLOW ZERO LENGTH set to YES and
REQUIRED set to NO)-->
to MySQL.  Would these settings change with the export, and how would I
verify those settings?

I don't know what the equivalent to DESIGN
VIEW is in MySQL, though I have been working with the program for 4 months.

SELECT ID, Authors, Title
FROM josetextfile
WHERE Authors LIKE '%varAuthor%' and 'varAuthor' <> '' OR
Keywords LIKE '%varKeyword%' and 'varKeyword' <> '' OR
Title LIKE '%varTitle%' and '%varTitle%' <> ''ORDER BY Year, Authors,
Publication, Title, NoPages,
PublicationCategory

DEFAULT VALUE        RUN-TIME VALUE
varAuthor     1            request.getParameter(txtAuthor)
varTitle      1            request.getParameter(txtTitle)
varKeyword    1            request.getParameter(txtKeyword)


Is the default value setting of "1" the problem???

Here is the 1) URL generated, 2)the default value setting code  and 3) The
SQL code :
http://localhost/jserv/Frame6_Results2.jsp?txtAuthor=Collins&txtTitle=geomet
ry&txtKeyword=&butSubmit

<%
String rsSimpleSearch__varAuthor = "1";
if (request.getParameter("txtAuthor")  !=null) {rsSimpleSearch__varAuthor =
(String)request.getParameter("txtAuthor") ;}
%>
<%
String rsSimpleSearch__varTitle = "1";
if (request.getParameter("txtTitle")  !=null) {rsSimpleSearch__varTitle =
(String)request.getParameter("txtTitle") ;}
%>
<%
String rsSimpleSearch__varKeyword = "1";
if (request.getParameter("txtKeyword")  !=null) {rsSimpleSearch__varKeyword
= (String)request.getParameter("txtKeyword") ;}
%>
<%
Driver DriverrsSimpleSearch =
(Driver)Class.forName(MM_connJOSE_DRIVER).newInstance();
Connection ConnrsSimpleSearch =
DriverManager.getConnection(MM_connJOSE_STRING,MM_connJOSE_USERNAME,MM_connJ
OSE_PASSWORD);
PreparedStatement StatementrsSimpleSearch =
ConnrsSimpleSearch.prepareStatement("SELECT ID, Authors, Title  FROM
josetextfile  WHERE Authors LIKE '%" + rsSimpleSearch__varAuthor + "%'  AND
Authors <> '' OR Keywords LIKE '%" + rsSimpleSearch__varKeyword + "%'  and
Keywords <> '' OR Title LIKE '%" + rsSimpleSearch__varTitle + "%' AND Title
<> ''  ORDER BY Year, Authors, Publication, Title, NoPages,
PublicationCategory");
ResultSet rsSimpleSearch = StatementrsSimpleSearch.executeQuery();




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to