ID:               36788
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bubblenut at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         PDO related
 Operating System: Linux 2.6.12 (Kubuntu)
 PHP Version:      5.1.2
 New Comment:

Ignore them. I believe you don't need PEAR to test PDO.


Previous Comments:
------------------------------------------------------------------------

[2006-03-20 11:41:57] bubblenut at gmail dot com

Discovered that I can still use php but I'm still getting the same
result

array(0) {
}
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(2) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
}

------------------------------------------------------------------------

[2006-03-20 11:35:03] bubblenut at gmail dot com

I get the following error when doing the make install

SECURITY ERROR: PHP_Archive::mapPhar can only be called from within the
phar that initiates itInstalling PDO headers:         
/usr/local/php/include/php/ext/pdo/


Also earlier in the make install I get the following libtool warning
libtool: install: warning: remember to run `libtool --finish
/usr/local/src/php5.1-200603200930/libs'

------------------------------------------------------------------------

[2006-03-20 11:09:14] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip



------------------------------------------------------------------------

[2006-03-20 00:55:22] bubblenut at gmail dot com

Ahh, sorry, little typo, OK it looks like it's just in the parameter
insertion then (do I need to start a new bug report?)

Revised Code
------------
<?php
//phpinfo();

$db   = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare("SELECT id FROM recipe WHERE id=?");
$stmt->bindValue(1, 1);
$stmt->execute();
$res = $stmt->fetchAll();
var_dump($res);

$stmt = $db->prepare("SELECT id FROM recipe WHERE id=1");
$stmt->execute();
$res  = $stmt->fetchAll();
var_dump($res);

foreach($db->query("SELECT id FROM recipe WHERE id=1") as $res) {
    var_dump($res);
}

Expected Result
---------------
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(2) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
}

Actual Result
-------------
array(0) {
}
array(1) {
  [0]=>
  array(2) {
    ["id"]=>
    string(1) "1"
    [0]=>
    string(1) "1"
  }
}
array(2) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
}

------------------------------------------------------------------------

[2006-03-20 00:40:03] [EMAIL PROTECTED]

It still doesn't work without execute() after prepare().
And after adding this execute() call, it works _just fine_.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/36788

-- 
Edit this bug report at http://bugs.php.net/?id=36788&edit=1

Reply via email to