Jump to content

dclamp

Members
  • Posts

    102
  • Joined

  • Last visited

    Never

Posts posted by dclamp

  1. Every form value is always "set" per say. Try checking if the value is equal to nothing:

     

    if(isset($_POST['incoming_data']))
          {      
             if($_POST['director']=="" || $_POST['class']=="" || $_POST['description']=="")      
    {
                echo "Error! All fields must be filled out!";
             }
             else
             {
                $director = $_POST['director'];
                $room = $_POST['room'];
                $class = $_POST['class'];
                $description = $_POST['description'];
             
                //do a mail() call         
    }                             
    }      
    

  2. Umm, what do you mean by table setup?

    I think the point of the question is to determine whether a subcategory is associated with a specific category, because you may be able to execute a single SQL query to retrieve data from both tables in one go

     

    Yeah thats what i was getting at...

  3. Neither of your solutions will work as lets say someone has a birthday of 2 Jan 1987

     

    I would use 2 Jan 2009 and I'd do that by checking current year and adding it onto day "2 Jan $year"

     

    But what if it was december 30th 2009, there next birthday would show as "2 Jan $year" which would be "2 Jan 2009"  hence its in the past when it needed to be "2 Jan 2010"

     

    Thats the problem, its not as simple as date - date = second remaining

     

    Thats not our problem. Our scripts bother give the seconds remaining given the birthday is AFTER todays date. My script Will tell you if it is past or not.

  4. try using strtotime()

     

    
    $birthday = "20th January 2009";
    $bts = strtotime($birthday);
    $ts = time();
    
    if ($bts > $ts) {
         // checks if birthday is AFTER todays date
         $remaining = $bts - $ts;
         echo "Seconds: " . $remaining; // Will output in seconds
         echo "Days: " . ($remaining / 86400); // Outputs days remaining
    } else {
         echo "Birthday Already Passed!";
    }
    

  5. If you know basic PHP and MySQL then this should be easy.

     

    $firstname = mysql_real_escape_string($_POST['firstname']);
    $lastname = mysql_real_escape_string($_POST['lastname']);
    $studentid = mysql_real_escape_string($_POST['studentid']);
    
    $query = mysql_query("SELECT * FROM `students` WHERE firstname='{$firstname}' AND lastname='{$lastname}' AND studentid='{$studentid}'");
    $num = mysql_num_rows($query);
    
    if ($num == 1) {
         // is a student
    } else {
        // not a student
    }
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.