Connection to database on Amazon

Asked

Viewed 60 times

1

Good afternoon, I have a sqlserver database hosted on Amazon, and can’t perform the connection in php, there is some specific way to do this?

I tried the connection this way:

<?php
$servername = "link do server";
$username = "usuario";
$password = "senha";

$conn = mysqli_connect($servername, $username, $password);

if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>

2 answers

0


If the DBMS is Microsoft SQL Server it is not possible to use the functions of the Enhanced Mysql Extension (mysqli).

0

You can try this two simplified ways

echo $conn = mysqli_connect("127.0.0.1", "usuario", "senha", "nome db") or die("Connection failed: " . mysqli_connect_error($conn));

or:

echo $conn = mysqli_connect("localhost", "usuario", "senha", "nome db") or die("Connection failed: " . mysqli_connect_error($conn));

If you have more questions, you can try the function manual:

http://php.net/manual/en/function.mysqli-connect.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.