Ejemplo n.º 1
0
<form method="POST">
<input type="text" id="url" name="url" value="http://example.com/data2iidxsd.sql" size="50" /><br />
<input type="submit" value="import" />
</form>
<form method="POST">
<input type="hidden" id="split" name="split" value="1" />
<input type="submit" value="split" />
</form>
</body>
</html>
HTML;
if ($_POST["split"] == "1") {
    execSplit();
}
if ($_POST["url"]) {
    inputData();
}
function inputData()
{
    $url = $_POST["url"];
    $data = file_get_contents($url);
    $data = str_replace("\r\n", "\n", $data);
    $data = str_replace("\r", "\n", $data);
    $list = explode("\n", $data);
    array_shift($list);
    //$num = count($list);
    $sql = <<<SQL
DROP TABLE IF EXISTS temp cascade;
CREATE TABLE temp(
id serial,
no character(4) not null,
Ejemplo n.º 2
0
<?php

include "../controller/function.php";
$nis = $_POST['nis'];
$nama = $_POST['nama_sales'];
$alamat = $_POST['alamat'];
$telp = $_POST['telp'];
$cabang = $_POST['cabang'];
$stmt = "insert into sales values('{$nis}', '{$nama}', '{$alamat}', '{$telp}', '{$cabang}')";
if (inputData($stmt)) {
    echo '{"status":"Data Sales Berhasil Disimpan"}';
} else {
    echo '{"status":"Data Dales Gagal Disimpan"}';
}