I am new to SQL database and was wondering If a user can have access to a database without providing a password. Or do I have to pass in an empty password field 'PWD' => ''
Sample code with password filed removed:
$connInfo = array(
'Database' => 'mystore',
'UID' => 'admin_user',
/*password field removed*/
'ReturnDatesAsStrings' => true
);
$connectString = sqlsrv_connect('some.sever.name', $connInfo) or die("Can't connect to the database");
$query = 'SELECT * FROM products';
$data = sqlsrv_query($connectString, $query) or die(print_r(sqlsrv_errors(SQLSRV_ERR_ALL), true));
while ($row = sqlsrv_fetch_array($data))
{
//Graduate
echo "<tr>";
echo " " .$row['NAME'] ." - " .$row['EMAIL'] ." ";
echo "</tr><br>";
}
sqlsrv_free_stmt($data);
sqlsrv_free_stmt($query);
?>
I am doing this for a testing purposes and not going to upload this in to a website without a password. Can you please tell me if the syntax of the above code is valid?