Advertisement
Guest User

Untitled

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