0

I have a very simply function that is failing (it simply dies and doesn't complete at all--no error is printed), and I don't understand why. Here is my function:

global $db;
$query = "Yadda Yadda Yadda….";
$results = $db->query($query)->fetchAll();
return $results;

The actual query string is correct, because I can print it out, manually execute it, and get the expected results back.

Based on 'echo'ing things back, it seems like the function dies at the actual execution stage. I have tried it without the "->fetchAll()" too, to no avail.

I feel like it's obvious, but I just don't see it...Thanks in advance.

Jo.P
  • 1,139
  • 4
  • 15
  • 35
  • checklist: [ ] enabled error logging to file in PHP.ini / [ ] set reporting to the highest level / [ ] tail -f on the error log in shell – hakre Dec 23 '14 at 20:26
  • is $db a pdo object? – Joe Thomas Dec 23 '14 at 20:26
  • @hakre-um, what? Sorry, don't understand what you're saying I should do… :/ Sry. – Jo.P Dec 23 '14 at 20:31
  • @wateriswet-It's the variable all the other functions use before using a database connection. I believe it is a PDO object, unless I am misunderstanding something. – Jo.P Dec 23 '14 at 20:33
  • @hakre-I followed the instructions/duplicate question link and resolved 1 issue (had to do with an upgrade to PHP last night). Now the only error is that it thinks the fetchAll() is being called on a non-object. Which is odd, bec I don't see why it isn't an object…Working on it, and thanks for your the pointer! – Jo.P Dec 23 '14 at 20:56

0 Answers0