Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1.  
  2. <?php
  3.        $dsn="SLQSERVER";
  4.        $username="sa";
  5.        $password="";
  6.  
  7.        //Then you call the odbc_connect function to connect to the database using the
  8.        //appropriate credentials. odbc_exec is then used to send a query to SQL Server:
  9.  
  10.        $sqlconnect=odbc_connect($dsn,$username,$password);
  11.        $sqlquery="SELECT * FROM Car;";
  12.        $process=odbc_exec($sqlconnect, $sqlquery);
  13.  
  14.        //Finally, you extract all of the companies from the Customers table and
  15.        //display them onscreen in a list. Once the entire list has been displayed,
  16.        //the connection to the database is closed:
  17.  
  18.        while(odbc_fetch_row($process)){
  19.  
  20.               $companyName = odbc_result($process,"*");
  21.  
  22.        echo "$companyName<br>";
  23. }
  24.  
  25.        odbc_close($sqlconnect);
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement