mirror of
https://gitlab.com/harald.mueller/aktuelle.kurse.git
synced 2024-11-30 13:41:58 +01:00
54 lines
923 B
PHP
54 lines
923 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: mvorelli
|
|
* Date: 15.11.2017
|
|
* Time: 12:13
|
|
*/
|
|
|
|
// http://localhost:8080/pdo/pdo.php
|
|
|
|
|
|
echo "PDO ODBC Demo File";
|
|
|
|
$user="root";
|
|
$pw = "";
|
|
$dsn ="odbc:PDO_Connection";
|
|
|
|
// $dsn ="odbc:lokal_MysqlServer"; PHP 5.x only supported
|
|
// if (!($myConn = odbc_connect('PDO_Connection','root',''))) {
|
|
// echo "No ODBC connection<br />";
|
|
// }
|
|
// else echo "DB Connection ok<br>";
|
|
|
|
try
|
|
{
|
|
$dbconn = new PDO($dsn,$user,$pw);
|
|
foreach ($dbconn->query('SELECT * from tbl_orte') as $row) {
|
|
print_r($row);
|
|
}
|
|
// close DB connection
|
|
$dbconn = null;
|
|
}
|
|
catch (PDOException $e) {
|
|
print "ODBC Error!: " . $e->getMessage() . "<br/>";
|
|
die();
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
$pdo = new PDO('pgsql:host=192.168.137.1;port=5432;dbname=anydb', 'anyuser', 'pw');
|
|
sleep(5);
|
|
$stmt = $pdo->prepare('SELECT * FROM sometable');
|
|
$stmt->execute();
|
|
$pdo = null;
|
|
sleep(60);
|
|
|
|
**/
|
|
|
|
?>
|
|
|
|
|
|
|