Afficher un message
Vieux 13/06/2008, 15h41   #2
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: What's this PDO error?

Harris Kosmidhs wrote:
> I 'm having the following statement:
>
> try {
> $db = new PDO('mysql:host=localhost;dbname=genderstudies', 'XXX',
> 'YYY', array(PDO::ATTR_PERSISTENT => true));
> $db->exec("SET NAMES UTF8") or die(print_r($db->errorInfo()));
> } catch (PDOException $e) {
> print "Error!: " . $e->getMessage() . "<br/>";
> die();
> }
>
> I get an error like this:
> Array ( [0] => 00000 ) 1



There is no error. From the manual:
"PDO::exec() executes an SQL statement in a single function call,
returning the number of rows affected by the statement. "

No rows affected, returns 0, is cast to false, and you incorrectly
assume 0 is a problem in this context. Use & trust the exceptions, the
return is not of importance to you right now.
--
Rik Wasmus
....spamrun finished
  Réponse avec citation
 
Page generated in 0,06327 seconds with 9 queries