Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. DROP PROCEDURE IF EXISTS getJobs;
  2. DELIMITER $$
  3. CREATE PROCEDURE getJobs(IN inputName VARCHAR(50))
  4. BEGIN
  5. SELECT JobNo FROM jobs WHERE PersonnelName= inputName;
  6. END $$
  7. DELIMITER ;
  8.  
  9. <?php
  10. //imports the connection
  11. require "conn.php";
  12.  
  13. $name = "chrisf";
  14.  
  15. $call = mysqli_prepare($conn, 'CALL getJobs(?)');
  16. mysqli_stmt_bind_param($call, 's', $name);
  17. mysqli_stmt_execute($call);
  18. $result = mysqli_use_result($conn);
  19.  
  20. //debug to check the result
  21. echo '<pre>'; print_r($result); echo '</pre>';
  22. //loop the result set and echo
  23. while ($row = mysqli_fetch_array($result)){
  24. //the command I expect to output the result
  25. echo "Entry" . $row[0] . "<br>";
  26. //debug to check the result
  27. echo "Entry" . $row . "<br>";
  28. }
  29.  
  30. $conn->close();
  31. ?>
  32.  
  33. mysqli_result Object
  34. (
  35. [current_field] => 0
  36. [field_count] => 1
  37. [lengths] =>
  38. [num_rows] => 0
  39. [type] => 1
  40. )
  41.  
  42. Entry
  43. EntryArray
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement