Advertisement
Guest User

Untitled

a guest
May 11th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. echo "hello2";
  3. $myServer = "esgsqlwhdev01";
  4. $myUser = "lportal";
  5. $myPass = "lportal";
  6. $myDB = "lportal";
  7.  
  8. //connection to the database
  9. $dbhandle = mssql_connect($myServer, $myUser, $myPass)
  10. or die("Couldn't connect to SQL Server on $myServer");
  11.  
  12. //select a database to work with
  13. $selected = mssql_select_db($myDB, $dbhandle)
  14. or die("Couldn't open database $myDB");
  15.  
  16. //declare the SQL statement that will query the database
  17. $query = "SELECT * FROM SYRTarget";
  18. //$query .= "FROM cars ";
  19. //$query .= "WHERE name='BMW'";
  20.  
  21. //execute the SQL query and return records
  22. $result = mssql_query($query);
  23.  
  24. $numRows = mssql_num_rows($result);
  25. echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
  26. /*
  27. //display the results
  28. //while($row = mssql_fetch_array($result))
  29. //{
  30. // echo $numRows;
  31. //}
  32. //close the connection
  33. mssql_close($dbhandle);
  34. */
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement