in reply to Unexplained MySQL Error
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Unexplained MySQL Error
by dbwiz (Curate) on Jul 20, 2003 at 18:46 UTC | |
by jbeninger (Monk) on Jul 21, 2003 at 02:07 UTC | |
by jbeninger (Monk) on Jul 21, 2003 at 13:54 UTC | |
by Anonymous Monk on Jul 21, 2003 at 14:06 UTC | |
by jbeninger (Monk) on Jul 21, 2003 at 14:31 UTC | |
|
Solved!
by jbeninger (Monk) on Jul 20, 2003 at 15:43 UTC |