Beispiel #1
0
function checkNotes($notes, $dataManager)
{
    // Look if there's a subtable to be displayed
    $check = preg_match("/¬(.*?)¬/", $notes, $matches);
    //print_r($check);
    //print_r($matches);
    for ($i = 1; $i <= $check; $i++) {
        $found = $matches[round($i / 2) - 1];
        $id = explode(":", $matches[round($i / 2)]);
        //echo '<br />Subtable '. $id[1] .' needed!!!!<br />';
        $sql = "SELECT * FROM " . $dataManager->dbName . ".dbdocssubtables WHERE subTableId = " . chkVars($id[1]);
        $row = $dataManager->executeQuery($sql);
        if ($row) {
            //echo $row["subTableContent"] .'<br />';
            $notes = str_replace($found, $row["subTableContent"], $notes);
        } else {
            //echo '<p>Warning! Infommation not avaiable. Add into database</p>';
            $notes = str_replace($found, "<b>**" . $found . " not found**</b>", $notes);
        }
        //$notes = str_replace($found, "TABELLA!",$notes);
    }
    return $notes;
}
Beispiel #2
0
                <input type="submit" value="Modify" />
            </td>
        </tr>
    </table>


<?php 
                } else {
                    echo "Unable to identify the object to edit";
                }
            } else {
                //do the modify
                $sql = "UPDATE " . $dataManager->dbName . ".dbdocsfields \r\n\t\t\t\t\t\tSET fieldComment = " . chkVars($_GET["txtFieldComment"]) . ", fieldNotes = " . chkVars($_GET["txtFieldNotes"]) . " \r\n\t\t\t\t\t\tWHERE fieldId = " . chkVars($editRowId);
                $editRes = $dataManager->executeQuery($sql);
                if ($editRes) {
                    echo "Modify applied with success! This is the query to copy-paste into SQL updates files: <br/> \r\n\t\t\t\t\t\t<b>UPDATE dbdocsfields \r\n\t\t\t\t\t\tSET fieldComment = " . htmlentities(chkVars($_GET["txtFieldComment"])) . ", fieldNotes = " . htmlentities(chkVars($_GET["txtFieldNotes"])) . " \r\n\t\t\t\t\t\tWHERE fieldId = " . chkVars($editRowId) . "</b>";
                } else {
                    echo "There was errors on update. Operation aborted.";
                }
            }
            break;
        default:
            echo "Subject to modify is missing.";
            break;
    }
    ?>
</form>
<?php 
} else {
    echo "Row identifier missing.";
}