Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- $host = "winsql.vereb.dc";
- $user = "diak64";
- $pw = "Jo1Jtn";
- $db = "diak64";
- try{
- $pdo = new PDO("mysql:host={$host};dbname={$db}",$user,$pw);
- echo "CONN SUCC\n";
- }
- catch(PDOException $e){
- die($e->getMessage());
- }
- try{
- $exe = $pdo->prepare("SELECT * FROM nums");
- if(!$exe->execute()){
- throw new PDOException ($exe->errorinfo()[2]);
- }
- else{
- print_r($exe->fetchAll());
- }
- $exe = $pdo->prepare("INSERT INTO `nums` (`num`,`char`) VALUES (6699,'F')");
- if(!$exe->execute()){
- throw new PDOException ($exe->errorinfo()[2]);
- }
- $exe = $pdo->prepare("SELECT * FROM nums");
- if(!$exe->execute()){
- throw new PDOException ($exe->errorinfo()[2]);
- }
- else{
- print_r($exe->fetchAll());
- }
- }
- catch(PDOException $e){
- print $e->getMessage();
- }
- ?>
- </pre>
Advertisement
Add Comment
Please, Sign In to add comment