Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <?php require 'get_yards.php';?>
  2.  
  3. <?php
  4. include "/resources/library/get_yards2.php";
  5. ?>
  6.  
  7. <?php
  8. require_once(__DIR__.'/../config.php');
  9. // Get the DB connection settings
  10. $dbHost = $config["db"]["server"]["host"];
  11. $dbUser = $config["db"]["server"]["username"];
  12. $dbPass = $config["db"]["server"]["password"];
  13. $dbName = $config["db"]["server"]["dbname"];
  14. $connectionInfo = array( "Database"=>$dbName, "UID"=>$dbUser, "PWD"=>$dbPass);
  15. $conn = sqlsrv_connect( $dbHost, $connectionInfo);
  16. if( $conn === false ) {
  17. die( print_r( sqlsrv_errors(), true));
  18. }
  19.  
  20. $query = "SELECT YardId,Yard FROM YWBYard";
  21. $params = array();
  22. $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
  23.  
  24. $result = sqlsrv_query($conn, $query);
  25.  
  26. if( $result === false){
  27. if( ($errors = sqlsrv_errors() ) != null) {
  28. foreach( $errors as $error ) {
  29. echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />";
  30. echo "code: ".$error[ 'code']."<br />";
  31. echo "message: ".$error[ 'message']."<br />";
  32. }
  33. }
  34. }
  35. else {
  36. $numRows = sqlsrv_num_rows($result);
  37. while($row = sqlsrv_fetch_array($result))
  38. {
  39. if($row['YardId']===1){
  40. echo "<li>"."<a href="."http://shunterweb/".">".$row['Yard'],"</a></li>";
  41. }
  42. elseif($row['YardId']===2){
  43. echo "<li>"."<a href="."http://shunterweb/bicker.php".">".$row['Yard'],"</a></li>";
  44. }
  45. else{
  46. echo "<li>"."<a href="."http://shunterweb/crick.php".">".$row['Yard'],"</a></li>";
  47. }
  48. }
  49. }
  50. sqlsrv_free_stmt($result);
  51. sqlsrv_close($conn);
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement