Esempio n. 1
0
function printResults($name, $cols, $data)
{
    $attributes = array();
    while ($row = OCI_Fetch_Array($cols, OCI_NUM)) {
        $attributes[] = $row[0];
    }
    echo "<br>INSERT NEW<br>(enter value for each attribute)";
    printInsertFields($name, $attributes);
    echo "<br>UPDATE<br>(search for the row to change, then choose attribute to change and enter new value)<br>";
    printUpdateFields($name, $attributes);
    echo "<br>DELETE<br>(search for the row to delete)<br>";
    printDeleteFields($name, $attributes);
    echo "<br>DATA FROM TABLE " . $name . "<br>";
    printTable($attributes, $data);
}
Esempio n. 2
0
	<?php 
    for ($it = 0; $it < $numbaggages; $it++) {
        echo "Enter the weight of bag " . number_format($it + 1) . ":\r\n\t\t\t<input type='number' name='weight{$it}' id='baggages' step='any' style='width:60px' min='0'>Kg<br>";
    }
    ?>
		</table>
		<button type="submit" class="pure-button pure-button-primary" name="finalsubmit">Submit</button>
	</form>
	<?php 
}
// Connect Oracle...
if ($db_conn) {
    if (array_key_exists('numbaggages', $_POST)) {
        //echo "I am in insertsubmit<br>";
        setcookie('numbaggages', $_POST['numbaggages']);
        printInsertFields($_POST['numbaggages']);
    }
    if (array_key_exists('finalsubmit', $_POST)) {
        //echo "I am in finalsubmit<br>";
        for ($i = 0; $i < $_COOKIE['numbaggages']; $i++) {
            //	echo "For".$i;
            //Getting the values from user and insert data into the table
            //set default status to checked in
            executePlainSQL("\r\n\t\t\t\t\tinsert into has_B values \r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tbid_sequence.nextval,\t\t\r\n\t\t\t\t\t\t\t\t" . $_COOKIE['cid'] . ",\t\r\n\t\t\t\t\t\t\t\t3,\r\n\t\t\t\t\t\t\t\t" . $_POST['weight' . $i] . ",\r\n\t\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s', time()) . "'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t");
            OCICommit($db_conn);
            // Last location
            executePlainSQL("insert into last_location \r\n\t\t\t\t\tselect bid_sequence.currval as bid, a.code\r\n\t\t\t\t\tfrom Airport a\r\n\t\t\t\t\twhere a.city = '" . $_COOKIE['depcity'] . "' and a.country = '" . $_COOKIE['depcountry'] . "'");
            OCICommit($db_conn);
            //delete cookie
            setcookie('numbaggages', null, 0);
            ?>