"; if ($aTypes[$iColumnCount] == 2) { if (strpos("value", $aKeys[$i]) == 0) { //uncheck check box $aValues[$iColumnCount] = 0; } else { $aValues[$iColumnCount] = 1; $i++; } } else { $aValues[$iColumnCount] = $_POST[$aKeys[$i]]; $i++; }*/ $aValues[$iColumnCount] = $_POST[$aKeys[$i]]; $i++; $sRowStart = $aKeys[$i]; $iColumnCount++; } if ($iPrimaryKey < 0) { //perform an insert $sQuery = "INSERT INTO $sTableName ("; for ($j = 0; $j < count($aColumns) - 1; $j++) { $sQuery .= $aColumns[$j] . ", "; } $sQuery .= $aColumns[count($aColumns) -1] . ") VALUES ("; for ($j = 0; $j < count($aColumns) - 1; $j++) { switch ($aTypes[$j]) { case 0 : $sQuery .= $aValues[$j] . ", "; break; case 1: //text $sQuery .= "'" . addslashes($aValues[$j]) . "', "; break; case 2: //boolean break; case 3: //drop down list break; default: break; } } switch ($aTypes[count($aColumns) - 1]) { case 0: //id $sQuery .= $aValues[count($aColumns) - 1] . ") "; break; case 1: //text $sQuery .= "'" . addslashes($aValues[count($aColumns) - 1]) . "') "; break; case 2: //boolean break; case 3: //drop down list break; default: break; } //execute the query $sql = $default->db; $sql->query($sQuery); } else { //perform an update $sQuery = "UPDATE $sTableName SET "; for ($j = 0; $j < count($aColumns) -1; $j++) { $sQuery .= $aColumns[$j] . " = "; switch ($aTypes[$j]) { case 0: //id $sQuery .= $aValues[$j] . ", "; break; case 1: $sQuery .= "'" . addslashes($aValues[$j]) . "', "; break; default: break; } } $sQuery .= $aColumns[count($aTypes) -1] . " = "; switch ($aTypes[count($aTypes) -1]) { case 0: //id $sQuery .= $aValues[count($aTypes) -1] . " "; break; case 1: $sQuery .= "'" . addslashes($aValues[count($aTypes) -1]) . "' "; break; default: break; } $sQuery .= "WHERE id = $iPrimaryKey"; //execute the query $sql = $default->db; $sql->query($sQuery); } } } redirect(urldecode($fReturnURL)); ?>