Ubuntu: Connect php7.0 with sqlserver using pdo.

<?php // sudo apt install php7.0-sybase header("content-type: text/plain; charset=iso-8859-1"); ini_set("display_errors","1"); error_reporting(E_ALL); $host="localhost"; $db="test"; $uid="sa"; $pwd="mypassword"; $query = "select top 10 * from testtable"; $conn = new PDO( "dblib:host=$host:1433;dbname=$db;", $uid, $pwd); $stmt = $conn->prepare( $query ); $stmt->execute(); while ($r=$stmt->fetch(PDO::FETCH_ASSOC)){ print_r($r); } ?>
Install PDO for php7.0, just to get connected to sqlserver

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.