Ignore:
Timestamp:
08/04/11 11:20:53 (13 years ago)
Author:
Daniela Dorner
Message:
key2 can be empty now
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/db_po/insert_po.php

    r11599 r11771  
    44    ini_set("mysql.trace_mode", "On");
    55
     6    // init
     7    //
     8    // values which cannot be empty
    69    if (empty($_GET["fUpdCase"]))
    710    {
     
    2427        return;
    2528    }
     29    if (empty($_GET["fValue"]))
     30    {
     31        echo "Please insert a value.<br>";
     32        return;
     33    }
     34    if (empty($_GET["fDescription"]))
     35    {
     36        echo "Please insert a description.<br>";
     37        return;
     38    }
     39    if (empty($_GET["fType"]))
     40    {
     41        echo "Please select a type.<br>";
     42        return;
     43    }
     44    // values which may be empty
    2645    if (empty($_GET["fKey2"]))
    27     {
    28         echo "Please select a key2.<br>";
    29         return;
    30     }
    31     if (empty($_GET["fValue"]))
    32     {
    33         echo "Please insert a value.<br>";
    34         return;
    35     }
    36     if (empty($_GET["fDescription"]))
    37     {
    38         echo "Please insert a description.<br>";
    39         return;
    40     }
    41     if (empty($_GET["fType"]))
    42     {
    43         echo "Please select a type.<br>";
    44         return;
    45     }
     46        $_GET["fKey2"]="";
    4647    if (empty($_GET["fOriginalIndex"]))
    4748        $_GET["fOriginalIndex"]="";
     
    9798
    9899    //check if key alread exists
    99     $query2="SELECT Count(*) from ProgramOption WHERE fKey1='".$_GET["fKey1"]."' AND fKey2='.".$_GET["fKey2"]."'";
     100    if (empty($_GET["fKey2"]))
     101        $query2="SELECT Count(*) from ProgramOption WHERE fKey1='".$_GET["fKey1"]."' AND ISNULL(fKey2)";
     102    else
     103        $query2="SELECT Count(*) from ProgramOption WHERE fKey1='".$_GET["fKey1"]."' AND fKey2='.".$_GET["fKey2"]."'";
    100104    $query2.=" AND fCounter=(Select Max(fCounter) from History)";
    101105    if (!$result2=mysqli_query($db_id, $query2))
     
    158162        $query0.=", fUser='".$_SERVER['PHP_AUTH_USER']."'";
    159163        $query0.=", fKey1='".$_GET["fKey1"]."'";
    160         $query0.=", fKey2='.".$_GET["fKey2"]."'";
     164        if (!empty($_GET["fKey2"]))
     165            $query0.=", fKey2='.".$_GET["fKey2"]."'";
    161166        $query0.=", fDescription='".$_GET["fDescription"]."'";
    162167        $query0.=", fType='".$_GET["fType"]."'";
Note: See TracChangeset for help on using the changeset viewer.