Exemplo n.º 1
0
<?php 
include "../database/connection.php";
$my_connection = new connection();
$my_connection->connectdb('wisma', 'wisma');
$stmt = "UPDATE KAMAR SET KELAS='" . $_POST["kelas"] . "', HARGA=" . $_POST['harga'] . ", KAPASITAS=" . $_POST['kapasitas'] . " WHERE NO='" . $_POST['no_kamar'] . "'";
$test = $my_connection->select($stmt);
header("Location: ../tambah_kamar.php");
?>

Exemplo n.º 2
0
/**
 * Exemplos de uso para class connection
 * @author Antonio Santos
 * @version 0.1
 */
$db = new connection();
/**
 * Exemplo de insert
 */
$fields_insert = array('field1' => 'first inserted field', 'field2' => 'second inserted field', 'field3' => 'third inserted field');
$result = $db->insert('table_name', $fields_insert, 'id');
/**
 * Exemplo de select
 */
$result = $db->select('table_name', array('*'), array('id' => 1));
/**
 * Exemplo de update
 */
$fields_update = array('field1' => 'first updated field', 'field2' => 'second updated field', 'field3' => 'third updated field');
$conditions = array('user' => 'tester');
$result = $db->update('table_name', $fields_update, $conditions, 'id');
/**
 * Exemplo de delete
 */
$conditions = array('id' => 1);
$result = $db->delete('table_name', $conditions);
/**
 * Exemplo de outras queries
 */
$result = $db->results_object('SELECT e.first_name, e.last_name, u.user_type, u.username FROM table_name AS e INNER JOIN second_table_name AS u ON e.id = u.employee_id');
Exemplo n.º 3
0
<?php

include_once 'connection.php';
$conn = new connection();
$result = $conn->select();
?>

<html>
<head>
	<title>CRUD</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.9/css/dataTables.bootstrap.min.css">
</head>
<body>

<div class="container">
    <div class="row">
        <div class="col-md-12">
	<div>
		<p>This is for trial</p>
		<a href="create.php" class="btn btn-info pull-right" role="button">Create new user</a>
	</div>
	<div>
	<table class="table table-striped table-bordered" align="center">
		 <thead>
		<tr>
			<td>First Name</td>
			<td>Last Name</td>
			<td>Addres</td>
			<td>Phone</td>
Exemplo n.º 4
0
        </div>
        <div class="col-md-8">
            <table class="table">
                <thead>
                <tr>
                    <th width="70px">No.</th>
                    <th width="200px">Nama Fasilitas</th>
                    <th width="20px;">Actions</th>
                </tr>
                </thead>
            </table>
            <div style="height: 480px;overflow: auto;">
                <table class="table table-striped">
                    <tbody >
                    <?php 
$stmt = $my_connection->select("SELECT * FROM FASILITAS ORDER BY ID_FASILITAS ");
while (($row = oci_fetch_array($stmt, OCI_BOTH)) != false) {
    ?>
                        <tr >
                            <td width="140px;"> <?php 
    echo $row["ID_FASILITAS"];
    ?>
</td >
                            <td width="400px;"> <?php 
    echo $row["FASILITAS"];
    ?>
</td >
                            <td width="10px;">
                                <form action="edit_kamar.php" method="post">
                                    <button type="submit" class="btn btn-default" aria-label="Left Align" value="<?php 
    echo $row["ID_FASILITAS"];
Exemplo n.º 5
0
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Kamar <i class="icon-angle-down"></i></a>
                    <ul class="dropdown-menu">
                        <li  class="active"><a href="career.html">Input</a></li>
                        <li><a href="blog-item.html">Edit</a></li>
                        <li><a href="faq.html">Delete</a></li>
                    </ul>
                </li>
                <li><a href="blog.html">Blog</a></li>
                <li><a href="contact-us.html">Contact</a></li>
            </ul>
        </div>
    </div>
</header><!--/header-->

<?php 
$stmt = $my_connection->select("SELECT * FROM KAMAR WHERE NO='" . $_POST['id_kamar'] . "'");
$row = oci_fetch_array($stmt, OCI_BOTH);
$stmt2 = $my_connection->select("SELECT * FROM KELAS WHERE ID_KELAS='" . $row['KELAS'] . "'");
$nama_kelas = oci_fetch_array($stmt2);
$stmt3 = $my_connection->select("\n          SELECT f.FASILITAS\n          FROM FASILITAS f,\n          (SELECT ID_FASILITAS FROM TERDAPAT_FASILITAS WHERE ID_KELAS='" . $row['KELAS'] . "') t\n          WHERE f.ID_FASILITAS=t.ID_FASILITAS\n          ");
?>

<div class="container" >

    <div class="row">
        <div class="col-lg-3" style="background-color:white;min-height: 320px;">
            <h2>Data Kamar</h2>
            <br>
                <label style="font-size: 16px;">Nomor Kamar :</label>
                <p><?php 
echo $row["NO"];
Exemplo n.º 6
0
        </div>
    </div>
</header><!--/header-->
<div class="container" >

<h2>Input</h2>
<div class="row">

    <div class="col-lg-4">
    <form action="submit_kamar.php" method="post">
        <div class="form-group">

            <label>Nomor kamar</label>
            <input type="text" class="form-control" name="no_kamar" value="<?php 
if (isset($_POST['wisma_select'])) {
    $stmt = $my_connection->select("SELECT COUNT(NO) FROM KAMAR WHERE ID_WISMA='" . $_POST['wisma_select'] . "'");
    $row = oci_fetch_array($stmt);
    if ($_POST['wisma_select'] == 'W001') {
        $prefix = 'F';
    } else {
        if ($_POST['wisma_select'] == 'W002') {
            $prefix = 'J';
        } else {
            if ($_POST['wisma_select'] == 'W003') {
                $prefix = 'B';
            }
        }
    }
    echo $prefix;
    printf("%03d", $row["COUNT(NO)"] + 1);
}
Exemplo n.º 7
0
<html>
	<head>
		<title>PHP Test</title>
	</head>
	<body>
		<?php 
require "db.php";
echo "Launching missile : {$_GET['missile']}<br>";
echo "Latitude locked : {$_GET['lat']}<br>";
echo "Longitude locked : {$_GET['lnt']}<br>";
$conn = new connection("localhost", "root", "f0nXsBgB", "nuclear");
$conn->insert("nuclear", ["lat", "lng", "type"], [$_GET["lat"], $_GET["lnt"], $_GET["missile"]]);
$data = $conn->shift($conn->select("nuclear", ["*"]));
foreach ($data as $row) {
    foreach ($row as $d) {
        echo "{$d}<br>";
    }
    echo "<br>";
}
?>
	</body>
</html>