Guest User

Untitled

a guest
Mar 8th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. $serverName = "value.cloudapp.net";
  2. $connectionInfo = array( "Database"=>"value", "UID"=>"value", "PWD"=>"value");
  3. $conn = sqlsrv_connect( $serverName, $connectionInfo);
  4. if( $conn === false )
  5. {
  6. echo "Could not connect.\n";
  7. print('<pre>');
  8. die( print_r( sqlsrv_errors(), true));
  9. print('</pre>');
  10. }
  11.  
  12.  
  13.  
  14. /*--------- The next few steps call the stored procedure. ---------*/
  15.  
  16. /* Define the Transact-SQL query. Use question marks (?) in place of
  17. the parameters to be passed to the stored procedure */
  18. $tsql_callSP = "{call InsertUser(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
  19.  
  20. /* Define the parameter array. By default, the first parameter is an
  21. INPUT parameter. The second parameter is specified as an INOUT
  22. parameter. Initializing $vacationHrs to 8 sets the returned PHPTYPE to
  23. integer. To ensure data type integrity, output parameters should be
  24. initialized before calling the stored procedure, or the desired
  25. PHPTYPE should be specified in the $params array.*/
  26.  
  27. //$date = date_create('2000-01-01');
  28. $date = '01-01-2000';
  29.  
  30. echo $date;
  31.  
  32. $Title = 'value';
  33. $FirstName = 'value';
  34. $MiddleName = 'value';
  35. $LastName = 'value';
  36. $Gender = 'value';
  37. $DOB = $date;
  38. $Email = 'value';
  39. $Phone = 'value';
  40. $Mobile = 'value';
  41. $ResidentialAddress = 'value';
  42. $ResidentialPostCode = 'value';
  43. $ResidentialSuburb = 'value';
  44. $ResidentialState = 'value';
  45. $ResidentialCountry = 'value';
  46. $PostalAddress = 'value';
  47. $PostalPostCode = 'value';
  48. $PostalSuburb = 'value';
  49. $PostalState = 'value';
  50. $PostalCountry = 'value';
  51. $BrowserDetails = 'value';
  52. $IsActive = 1;
  53. $Password = 'value';
  54. $Salt = 'value';
  55. $LastLogin = $date;
  56. $CompanyID = null;
  57. $Created = $date;
  58. $CreatedBy = 'value';
  59. $LastModified = $date;
  60. $LastModifiedBy = 'value';
  61. $Username = 'value';
  62. $UserRole = 'value';
  63.  
  64. $params = array(
  65. array($Title, SQLSRV_PARAM_IN),
  66. array($FirstName, SQLSRV_PARAM_IN),
  67. array($MiddleName, SQLSRV_PARAM_IN),
  68. array($LastName, SQLSRV_PARAM_IN),
  69. array($Gender, SQLSRV_PARAM_IN),
  70. array($DOB, SQLSRV_PARAM_IN),
  71. array($Email, SQLSRV_PARAM_IN),
  72. array($Phone, SQLSRV_PARAM_IN),
  73. array($Mobile, SQLSRV_PARAM_IN),
  74. array($ResidentialAddress, SQLSRV_PARAM_IN),
  75. array($ResidentialPostCode, SQLSRV_PARAM_IN),
  76. array($ResidentialSuburb, SQLSRV_PARAM_IN),
  77. array($ResidentialState, SQLSRV_PARAM_IN),
  78. array($ResidentialCountry, SQLSRV_PARAM_IN),
  79. array($PostalAddress, SQLSRV_PARAM_IN),
  80. array($PostalPostCode, SQLSRV_PARAM_IN),
  81. array($PostalSuburb, SQLSRV_PARAM_IN),
  82. array($PostalState, SQLSRV_PARAM_IN),
  83. array($PostalCountry, SQLSRV_PARAM_IN),
  84. array($BrowserDetails, SQLSRV_PARAM_IN),
  85. array($IsActive, SQLSRV_PARAM_IN),
  86. array($Password, SQLSRV_PARAM_IN),
  87. array($Salt, SQLSRV_PARAM_IN),
  88. array($LastLogin, SQLSRV_PARAM_IN),
  89. array($CompanyID, SQLSRV_PARAM_IN),
  90. array($Created, SQLSRV_PARAM_IN),
  91. array($CreatedBy, SQLSRV_PARAM_IN),
  92. array($LastModified, SQLSRV_PARAM_IN),
  93. array($LastModifiedBy, SQLSRV_PARAM_IN),
  94. array($Username, SQLSRV_PARAM_IN),
  95. array($UserRole, SQLSRV_PARAM_IN)
  96. );
  97.  
  98. /* Execute the query. */
  99. $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
  100. if( $stmt3 === false )
  101. {
  102. echo "Error in executing statement 3.\n";
  103. die( print_r( sqlsrv_errors(), true));
  104. }
  105.  
  106. /*Free the statement and connection resources. */
  107. sqlsrv_free_stmt($stmt3);
  108. sqlsrv_close($conn);
Add Comment
Please, Sign In to add comment