Jump to content

floppyraid

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by floppyraid

  1. Greetings,

     

    I'm building a very basic form and one of the checks I want to preform is far more difficult for me than I would have imagined. I am not very proficient (at all) with php, any help would be extremely appreciated.

     

    All I am trying to do is add a test/check with an error that the end user would see if they are trying to 'check out' a unit number that has already been checked out and has not been flagged as not 'returned'. Here is the snippet in question:

     

    $checkunitid = $_POST['uniid'];
    //checkexists($checkunitid);
    $q="select unit_id from check_in_out where `returned` = 'N' and unit_id = '" . $uniid . "'"
    function checkexists() {
       $result = mysql_query($q) or die(mysql_error());
       if($row = mysql_fetch_array($result)) {
          return 1;
       }
       return 0;
    }
    if (checkexists()) {
      echo "<font size=7 color=red>record exists</font>";
      exit();
    }
    

×
×
  • 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.