Ver Mensaje Individual
  #7 (permalink)  
Antiguo 08/11/2013, 13:01
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: Configurar PHP 5.3.0 con Sql Server

Revisa el manual PHP, te dejo este ejemplo muy básico:

Código PHP:
Ver original
  1. <?php
  2. $serverName = "serverName\instanceName";
  3. $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
  4. $conn = sqlsrv_connect( $serverName, $connectionInfo );
  5. if( $conn === false ) {
  6.     die( print_r( sqlsrv_errors(), true));
  7. }
  8.  
  9. $sql = "SELECT FirstName, LastName FROM SomeTable";
  10. $stmt = sqlsrv_query( $conn, $sql );
  11. if( $stmt === false) {
  12.     die( print_r( sqlsrv_errors(), true) );
  13. }
  14.  
  15. while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
  16.       echo $row['LastName'].", ".$row['FirstName']."<br />";
  17. }
  18.  
  19. sqlsrv_free_stmt( $stmt);

http://www.php.net/manual/es/functio...etch-array.php
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP