php - Access a database without a password? -
i new sql database , wondering if user can have access database without providing password. or have pass in empty password field 'pwd' => ''
sample code 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 database"); $query = 'select * 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 doing testing purposes , not going upload in website without password. can please tell me if syntax of above code valid?
there 2 ways connect sql database:
1) using sql password need specified credentials
2) or using domain authentication, credentials same logged in pc: option 1: data source=localhost; initial catalog=master;trusted connection = true option 2: data source=localhost; initial catalog=master;integrated security=sspi
but can check following link find connection string databases , variants of connection:
http://www.connectionstrings.com/
regards. majahide
Comments
Post a Comment