additional sql WHERE condition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geraldjr30
    New Member
    • Jan 2009
    • 60

    additional sql WHERE condition

    hi,

    i have the following:

    Code:
    $sql="SELECT admitday, shift, infocount FROM qry_sum WHERE admitday ='".$count."'";
    i would like to know how i can add an additional AND WHERE code = html form field. i am just not sure of the syntax.

    thanks in advance,
    geebee
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Simply add AND to your SQL, like so:

    Code:
    $query = "SELECT `row1` FROM `tbl1` WHERE `row2` = 0 AND `row3` = 1";
    Hope this helps,
    Markus.

    Comment

    • geraldjr30
      New Member
      • Jan 2009
      • 60

      #3
      thanks.. i figured it out... you also need the following to remember the form field upon form posting:

      Code:
      $FLD= $_POST["FLD"];

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by geraldjr30
        thanks.. i figured it out... you also need the following to remember the form field upon form posting:

        Code:
        $FLD= $_POST["FLD"];
        What does that have to do with your question?

        Comment

        • geraldjr30
          New Member
          • Jan 2009
          • 60

          #5
          i noticed that without it the page does not remember the posted form value to be used in the WHERE clause

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by geraldjr30
            i noticed that without it the page does not remember the posted form value to be used in the WHERE clause
            Ok. Glad you got it working.

            Markus.

            Comment

            Working...