Guest User

Untitled

a guest
Jan 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. function isaDupe($portableDB, $transactArray)
  2. {
  3. $ref = $transactArray["reference"];
  4. $date = $transactArray["qdate"];
  5. $time = $transactArray["time"];
  6.  
  7. //prints the query so I can run by hand to test
  8. print "SELECT `counter` FROM transactions WHERE (`reference` = '$ref' AND `qdate` = '$date' AND `time` = '$time') ";
  9.  
  10. if ($dupeSelectStmt = $portableDB->prepare("SELECT `counter` FROM transactions WHERE (`reference` = ? AND `qdate` = ? AND `time` = ?)"))
  11. {
  12. $dupeSelectStmt->bind_param('sss',$ref, $date, $time);
  13. $dupeSelectStmt->bind_result($counter);
  14. $dupeSelectStmt->execute();
  15.  
  16. while ($dupeSelectStmt->fetch())
  17. {
  18. break;
  19. }
  20.  
  21. $numRows = $portableDB->affected_rows;
  22.  
  23. if ($numRows > 0)
  24. return TRUE;
  25. else if ($numRows == -1)
  26. {
  27. print " ERROR: ";
  28. print_r($portableDB->error);
  29. print_r($dupeSelectStmt->error);
  30. return FALSE;
  31. }
  32. else
  33. return FALSE;
  34. }
  35. }
Add Comment
Please, Sign In to add comment