in reply to perl (mysql) question...
The statement handle execute() method returns undef on error. The '0E0' return only applies to non-SELECT handles, so I'll guess that your problem comes from basing the logic on that.
You'd be better off using a placeholder in $sql, but the statement looks ok. Are you sure %table contains what you think at the time it is bound?
A better test would use 'SELECT COUNT(*) FROM foo WHERE nick=?', checking for definedness and testing the result of one of the $sth->fetch* methods for the result.
If 'nick' is a primary key, an INSERT will fail if the key already exists. That may be a better approach for this.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: perl (mysql) question...
by CountZero (Bishop) on Dec 08, 2003 at 06:32 UTC | |
|
Re: Re: perl (mysql) question...
by kiat (Vicar) on Dec 08, 2003 at 07:03 UTC | |
by Zaxo (Archbishop) on Dec 08, 2003 at 18:36 UTC | |
by CountZero (Bishop) on Dec 08, 2003 at 23:24 UTC |