Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <?php
  2.  
  3. class packageInq {
  4. public $package;
  5. public $packageId;
  6. public $mysqli;
  7.  
  8. function __construct(){
  9. $mysqli = new mysqli('localhost', 'modpack', '*******', 'modpack');
  10. }
  11.  
  12.  
  13.  
  14.  
  15. function getPackage($pId, $argTyp=TRUE, $arg=NULL, $arg2Typ=TRUE, $arg2=NULL, $arg3Typ=TRUE, $arg3=NULL){
  16. $packageId = $pId;
  17. if ($argTyp){
  18. $query = "SELECT id, language, clientVersion, needExamination, title, description
  19. FROM localisation
  20. WHERE packageId = ?";
  21. echo $pId;
  22. $result = $mysqli -> prepare($query);
  23. $result -> bind_param('s', $packageId);
  24. echo 'testObjekt';
  25. } elseif ($arg2Typ) {
  26. $query = "SELECT id, language, clientVersion, needExamination, title, description
  27. FROM localisation
  28. WHERE packageId = ?
  29. AND ? = ?";
  30. $result = $mysqli->prepare($query);
  31. $result -> bind_param('sss', $packageId, $argType, $arg);
  32. }elseif ($arg3Typ) {
  33. $query = "SELECT id, language, clientVersion, needExamination, title, description
  34. FROM localisation
  35. WHERE packageId = ?
  36. AND ? = ?
  37. AND ? = ?";
  38. $result = $mysqli->prepare($query);
  39. $result -> bind_param('sssss', $packageId, $argType, $arg, $arg2Type, $arg2);
  40. }else {
  41. $query = "SELECT id, language, clientVersion, needExamination, title, description
  42. FROM localisation
  43. WHERE packageId = ?
  44. AND ? = ?
  45. AND ? = ?
  46. AND ? = ?";
  47. $result = $mysqli->prepare($query);
  48. $result -> bind_param('sssssss', $packageId, $argType, $arg, $arg2Type, $arg2, $arg3Type, $arg3);
  49. }
  50. $result -> execute();
  51. $result -> bind_result($package['id'], $package['language'], $package['clientVersion'], $package['needExamination'], $package['title'], $package['description'] );
  52. $result -> fetch();
  53. $result -> close();
  54. }
  55.  
  56. }
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement