Back to the month index |
Back to the list index
|
Jeff Pooser (jpooser@mars.gsd.harvard.edu)
Tue, 15 Apr 1997 15:48:30 +0000
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Dean Waldow: "[mSQL] IRIX6.2 and B5 or B6 Installation Problem."
- Previous message: John Fulmer: "Re: [mSQL] Re: B6 w3-msql fails with array"
- In reply to: David J. Hughes: "[mSQL] Re: B6 w3-msql fails with array"
Message-Id: <3353A342.79EA@gsd.harvard.edu> Date: Tue, 15 Apr 1997 15:48:30 +0000 From: Jeff Pooser <jpooser@mars.gsd.harvard.edu> Subject: Re: [mSQL] Boolean Searches with w3-msql??G.h.van den Berg wrote:
>
> Hi there,
> I was just wondering if anyone had found a way of doing AND or OR searches
> from a web page.
>
It's not pretty, lots of html table format in the output, but works like
a champ:
(see: http://www.gsd.harvard.edu/alum/directory)
here's the form: (abridged)
<INPUT TYPE="text" NAME="lname" VALUE="" SIZE=30 MAXLENGTH=30>
<INPUT TYPE="text" NAME="city" VALUE="" SIZE=30 MAXLENGTH=30>
<SELECT NAME="state">
<OPTION>AL- ALABAMA
<OPTION>AK- ALASKA
</SELECT></P>
<INPUT TYPE="text" NAME="country" VALUE="" SIZE=30 MAXLENGTH=30>
<INPUT TYPE="text" NAME="year" VALUE="" SIZE=4 MAXLENGTH=4></P>
<SELECT NAME="degree">
<OPTION>BAR- Bachelor of Architecture
<OPTION>BCP- Bachelor of City Planning
</SELECT>
pipe the submit thru /cgi-bin/w3-auth/web_path_to_results.htm
this is results.htm:
<!
if ($lname == "")
{
$lname = "%";
}
if ($city == "")
{
$city = "%";
}
if ($state == "")
{
$state = "%";
}
if ($country == "")
{
$country= "%";
}
if ($degree == "")
{
$degree = "%";
}
if ($year == "")
{
$year = "%";
}
$sock = msqlConnect();
if ($sock < 0)
{
echo("Error : $ERRMSG\n");
exit(1);
}
if (msqlSelectDB($sock,"alum") < 0)
{
echo("Error : $ERRMSG\n");
exit(1);
}
### these next two if statments parse out the info from the pulldown
menus on the form:
if ($state == "%")
{
}
else {
$statechop = split($state, "-");
$state = $statechop[0];
}
if ($degree == "%")
{
}
else {
$degreechop = split($degree, "-");
$degree = $degreechop[0];
}
$lname = msqlEncode($lname);
$city = msqlEncode($city);
$state = msqlEncode($state);
$country = msqlEncode($country);
$degree = msqlEncode($degree);
$year = msqlEncode($year);
if (msqlQuery($sock,"select Formname, Address1,
Address2, Address3,
City, State, Country, Zip, Home_Phone, Bus_Phone, Degree, Pref_Year,
Lname
from alum where Lname clike '$lname' and City clike '$city' and State
clike
'$state' and Country clike '$country' and Degree clike '$degree' and
Pref_Year clike '$year' ORDER BY Lname") < 0)
{
echo("Error : $ERRMSG\n");
exit(1);
}
$res = msqlStoreResult();
$row = msqlFetchRow($res);
printf("Number of results to your query: <b>%d</b> \n",
msqlNumRows($res));
printf("<p><br>");
printf("</blockquote><image src = /images/red_rule.gif WIDTH=528
HEIGHT=7><br><p
>\n");
while (#$row > 0)
{
printf("<TABLE BORDER=0 CELLSPACING=1 WIDTH=500
HEIGHT=167>
<TR> <TD WIDTH=200><P ALIGN=RIGHT>Name:</TD><TD
WIDTH=300><p><b>$row[0]</b> <
/TD></TR>\n");
printf("<TR><TD VALIGN=top WIDTH=200><P
ALIGN=RIGHT>Address:</TD
>\n");
printf("<TD WIDTH=300><P>$row[1] <br>\n");
if ($row[2] == ""){
printf("\n");
}
else{
printf("$row[2] <br>\n");
}
if ($row[3] == ""){
printf("\n");
}
else{
printf(" $row[3] <br>\n");
}
printf("</TD></TR>\n");
printf("<TR><TD WIDTH=200><P ALIGN=RIGHT>City:
</TD>\n");
printf("<TD WIDTH=300><p>$row[4] </TD></TR>\n");
if ($row[5] == "") {
printf("\n");
}
else {
printf("<TR><TD WIDTH=200><P ALIGN=RIGHT>State: </TD>\n");
printf("<TD WIDTH=300> <P>$row[5] </TD></TR> \n");
}
if ($row[6] == ""){
printf("\n");
}
else{
printf("<TR><TD WIDTH=200><P ALIGN=RIGHT>Country: </TD>
\n");
printf("<TD WIDTH=300><P>$row[6] </TD></TR> \n");
}
if ($row[7] == ""){
printf("\n");
}
else{
printf("<TR><TD WIDTH=200><P ALIGN=RIGHT>Zip Code: </TD>
\n");
printf("<TD WIDTH=300><P>$row[7] </TD></TR> \n");
}
if ($row[8] == ""){
printf("\n");
}
else{
printf("<TR><TD WIDTH=200><P ALIGN=RIGHT>Home Phone: </TD>\n");
printf("<TD WIDTH=300><P>$row[8] </TD></TR> \n");
}
if ($row[9] == ""){
printf("\n");
}
else{
printf("<TR> <TD WIDTH=200><P ALIGN=RIGHT>Business Phone: </TD> \n");
printf("<TD WIDTH=300><P>$row[9] </TD></TR> \n");
}
if ($row[10] == ""){
printf("\n");
}
else{
printf("<TR><TD WIDTH=200><P ALIGN=RIGHT>Degree:
</TD>\n");
printf("<TD WIDTH=300><P>$row[10] </TD></TR> \n");
}
if ($row[11] == ""){
printf("\n");
}
else{
printf("<TR>
<TD WIDTH=200>
<P ALIGN=RIGHT>Graduation Year:
</TD> \n");
printf("<TD WIDTH=300>
<P>$row[11] </TD></TR> \n");
}
printf("</table><p><br>");
printf("<image src = /images/red_rule.gif WIDTH=528
HEIGHT=7> <p
><br> \n");
$row = msqlFetchRow($res);
}
msqlFreeResult($res);
>
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- Next message: Dean Waldow: "[mSQL] IRIX6.2 and B5 or B6 Installation Problem."
- Previous message: John Fulmer: "Re: [mSQL] Re: B6 w3-msql fails with array"
- In reply to: David J. Hughes: "[mSQL] Re: B6 w3-msql fails with array"