Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $serverName = "TestDB,1433"; //serverNameinstanceName
- $connectionInfo = array( "Database"=>"Database123", "UID"=>"sa", "PWD"=>"Pass.124");
- $conn = sqlsrv_connect( $serverName, $connectionInfo);
- if( $conn ) {
- echo "Connection established.<br />";
- }
- else{
- echo "Connection could not be established.<br />";
- die( print_r( sqlsrv_errors(), true));
- }
- $sql="SELECT * from [Database123].[dbo].[LOG] ";
- $stmt=sqlsrv_query($conn,$sql);
- if ($stmt===false){
- die(print_r(sqlsrv_errors(), true));
- }
- echo "<table border='1'>
- <table class='table'>
- <thead>
- <tr>
- <th class='w'>Logon User</th>
- <th>Server Received Log Time</th>
- </tr>
- </thead>";
- while ($row =sqlsrv_fetch_Array($stmt,SQLSRV_FETCH_BOTH))
- {
- echo"<tbody>";
- echo"<tr>";
- echo"<td>".$row['基準日時']."</td>";
- //echo"<td>".$row['[基準日時]']->format('Y-m-d h-m-s')."</td>";
- echo"</tr>";
- echo"</tbody>";
- }
- echo"</table>";
- sqlsrv_close($conn);
- ?>
Add Comment
Please, Sign In to add comment