Advertisement
Guest User

Untitled

a guest
Nov 28th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. function sendSpId()
  2. {
  3. global $id;
  4. global $connection;
  5. $sql = "CALL `sp_st_SelectUserAll`($id)";
  6. $result = mysqli_query($connection, $sql);
  7. if ($result === FALSE) {
  8. die(mysqli_error($connection)); // TODO: better error handling
  9. }
  10. //loop the result set
  11. return mysqli_fetch_array($result);
  12.  
  13. }
  14.  
  15. <?php
  16. $serverName = "localhost";
  17. $userName = "root";
  18. $pass = "";
  19. $dbName = "univercity";
  20.  
  21. $connection = mysqli_connect($serverName, $userName, $pass, $dbName);
  22. mysqli_set_charset($connection, "utf8");
  23. if ( !$connection ) {
  24. die( 'connect error: '.mysqli_connect_error() );
  25. }
  26.  
  27.  
  28. ?>
  29.  
  30. BEGIN
  31. SELECT * FROM `students` WHERE `id`= id;
  32. END
  33.  
  34. $id = $_SESSION['id'];
  35.  
  36. Commands out of sync; you can't run this command now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement