Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2. require_once($_SERVER['DOCUMENT_ROOT'] . '/framework/classes/DBConnection.php');
  3.  
  4. define('DB_NAME', 'thename');
  5. define('DB_HOST', 'thehost.com');
  6. define('DB_USER', 'user');
  7. define('DB_PASSWORD', 'pwd');
  8.  
  9.  
  10.  
  11.  
  12. // Connect to database
  13. function db_connect() {
  14. return DBConnection::GetConnection();
  15. }
  16.  
  17.  
  18. function getMeta($conn) {
  19. $sql = "SELECT order_ref FROM orders LIMIT 0,1";
  20. $stmt = $conn->prepare($sql);
  21. $stmt->execute();
  22. $stmt->bind_result($ref);
  23. $stmt->fetch();
  24. $stmt->close();
  25. return $ref;
  26. }
  27.  
  28. function getMeta2($conn, $page) {
  29. $sql = "SELECT meta FROM pages_meta WHERE pageid = ?";
  30. $stmt = $conn->prepare($sql);
  31. $stmt->bind_param('s', $page);
  32. $stmt->execute();
  33. $stmt->bind_result($meta);
  34. $stmt->fetch();
  35. $stmt->close();
  36. return $meta;
  37. }
  38.  
  39.  
  40. $conn = db_connect();
  41. ?>
  42. </head>
  43. <body>
  44. <h1>Hello World</h1>
  45. <?php echo getMeta($conn); ?>
  46. <br>
  47. <?php echo getMeta2($conn, "homepage"); ?>
  48. </body>
  49. </html>
  50. <?php
  51. $conn->close();
  52. ?>
  53.  
  54. Hello World
  55.  
  56. 1407324725
  57.  
  58. Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 4294967296 bytes) in /home/rnsalarm/co2supermarket.co.uk/test.php on line 41
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement