コード例 #1
0
<?php

require '../vendor/autoload.php';
use Cagartner\SQLAnywhereClient as PDO;
try {
    $dns = "uid=teste;pwd=teste;ENG=teste;commlinks=tcpip{host=127.0.0.1;port=2638}";
    $con = new PDO($dns);
} catch (Exception $e) {
    echo $e->getMessage();
}
// SQL
$sql = "INSERT INTO usuario (name, email, password, status) VALUES ('Carlos', '*****@*****.**', '" . md5('teste') . "', 1) ";
$result = $con->exec($sql);
$con->commit();
if ($result) {
    echo "Novo registro inserido: " . $con->lastInsertId();
} else {
    $con->rollback();
}