Interview Question in SQL Server 2005 Driver for PHP
Interview Question :: Can you use Php with SQL server 2005? If so, can some one explain it or give links to tuts on how to do it
Yes; you work with it virtually the same way you work with MySQL server and the like. PHP has built-in MSSQL functions, just like it has built-in MySQL functions.
$link = mssql_pconnect( 'host', 'user', 'pass' ) or die( 'Cannot connect') ;
mssql_select_db( 'dbname' ) or die( 'Cannot select db' );
$query = "SELECT * FROM table";
$rs = mssql_query( $query ) or die( 'Cannot run query' );
while( $row = mssql_fetch_array( $rs ) ) {
echo $row['column']."
";
}

Loading ...