So in a general answer: the sql query I'm having a problem with was exactly as in the original post:
SELECT parent FROM categories WHERE id=1
I'm using the DBI error handling code, and that's what the apache logs give as the query, so it's not a matter of my not knowing what the query was. I should have made that clear.
As I said, the most puzzling part of it is that when you replace "parent" with "name" or "id", the query executes fine, and returns the respective name or id. When I copy the query directly from the error log and run it in the mysql shell, it runs fine.
As per numerous requests, here's the offending code:
sub getParentCategory { my ($child) = @_; my $res = getDb()->selectrow_arrayref("SELECT parent FROM categories + WHERE id=$child"); return $res ? $res->[0] : undef; }
Hope this helps you help me :) And for all of you looking for me eating my own words for thinking it could possibly be a problem in the db, and not in my code - keep an eye on this node - I'll post my solution if it's ever found.
Cheers
James Beninger
In reply to Re: Unexplained MySQL Error
by jbeninger
in thread Unexplained MySQL Error
by jbeninger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |