What's this PDO error?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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/>";

I get an error like this:
Array ( [0] => 00000 ) 1

What is this? I can connect to mysql correctly with the above
username/password and the db exists.


Re: What's this PDO error?

Harris Kosmidhs wrote:
Quoted text here. Click to load it

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

Site Timeline