I will definitely escape my arguments, I was going to take care of all that before I made it public.

What I want to do is only match speedtraps that match the query and comments that match the query.

The output will have 5 columns that list the speedtrap ID number, state, city, the approval status (all/new/yes/no), and the number of comments defined by the query search (all/new/yes/no). So I may want to search for speedtraps in Illinois that are NEW and that have comments that are NEW. Or I may want to search for speedtraps in Texas that are Yes (Approved) and comments that are NEW. This way when people put new speedtraps into the DB or new comments about an existing speedtrap, I'll be able to check them to make sure they look legit.

Here you can see how I will query the database. This is for the admin script so I can search for new speedtraps and new comments added to existing speedtraps.

<html> <body bgcolor=orange> <form action=../cgi-bin/sch_rcrd.pl method="POST" target=bottom> <input type=hidden name=action value="search_record"> <table bgcolor=white align="center" width="487"> <tr> <td width="173"> <table border=1> <tr> <th>State</th> </tr> <tr> <td><select name=state> <option value=all>ALL</option> <option value=AL>Alabama</option> <option value=AK>Alaska</option> <option value=AZ>Arizona</option> <option value=AR>Arkansas</option> <option value=CA>California</option> <option value=CO>Colorado</option> <option value=CT>Connecticut</option> <option value=DE>Delaware</option> <option value=FL>Florida</option> <option value=GA>Georgia</option> <option value=HI>Hawaii</option> <option value=ID>Idaho</option> <option value=IN>Indiana</option> <option value=IL>Illinois</option> <option value=IA>Iowa</option> <option value=KS>Kansas</option> <option value=KY>Kentucky</option> <option value=LA>Louisiana</option> <option value=ME>Maine</option> <option value=MD>Maryland</option> <option value=MA>Massachusetts</option> <option value=MI>Michigan</option> <option value=MN>Minnesota</option> <option value=MO>Missouri</option> <option value=MS>Mississippi</option> <option value=MT>Montana</option> <option value=NE>Nebraska</option> <option value=NV>Nevada</option> <option value=NH>New Hampshire</option> <option value=NJ>New Jersey</option> <option value=NM>New Mexico</option> <option value=NY>New York</option> <option value=NC>North Carolina</option> <option value=ND>North Dakota</option> <option value=OH>Ohio</option> <option value=OR>Oregon</option> <option value=OK>Oklahoma</option> <option value=PA>Pennsylvania</option> <option value=RI>Rhode Island</option> <option value=SC>South Carolina</option> <option value=SD>South Dakota</option> <option value=TN>Tennessee</option> <option value=TX>Texas</option> <option value=UT>Utah</option> <option value=VT>Vermont</option> <option value=VA>Virginia</option> <option value=WA>Washington State</option> <option value=DC>Washington DC</option> <option value=WV>West Virginia</option> <option value=WI>Wisconsin</option> <option value=WY>Wyoming</option> ## Canada ################################## <option value=AB>Alberta</option> <option value=BC>British Columbia</option> <option value=LB>Labrador</option> <option value=MB>Manitoba</option> <option value=NB>New Brunswick</option> <option value=NL>Newfoundland and Labrador</option> <option value=NS>Nova Scotia</option> <option value=NT>Northwest Territories</option> <option value=NU>Nunavut</option> <option value=PE>Prince Edward Island</option> <option value=ON>Ontario</option> <option value=QC>Quebec</option> <option value=SA>Saskatchewan</option> <option value=YU>Yukon Territory</option> </select></td> </tr> </table> </td> <td colspan="2" width="304"> <table border=1 align="center" width="242"> <tr> <th width="114"> <p align="center">Speedtrap Status</p> </th> <th width="112">Comment Status</th> </tr> <tr> <td width="114"> <p align="center"><select name=status> <option value="new">New</option> <option value="all">All</option> <option value="yes">Yes</option> <option value="no">No</option> </select></p> </td> <td width="112"> <p align="center"><select name=comment_sta +tus> <option value="new">New</option> <option value="all">All</option> <option value="yes">Yes</option> <option value="no">No</option> </select></p> </td> </tr> </table> </td> </tr> <tr> <td colspan=1 width="173"><center> <input type=submit name=action value='Go'></td> <td width="230"> <p align="center">Sort Key: &nbsp; <select name=sort1> <option value="approved" selected>Speedtrap Ap +proval</option> <option value="comment_approved">Comment Appro +val</option> <option value="id">ID</option> </select> &nbsp;<select name=sortord> <option value="DESC">Descending</option> <option value="ASC">Ascending</option> <input type=hidden name=action value='search_r +ecord'> </select> </p> </td> <td width="70"> &nbsp; </td> </tr> </table> </form> </body>

In reply to Re^2: Double Database Search and Sort by awohld
in thread Double Database Search and Sort by awohld

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.