Home » Database » DB » Bug #6832
no error messages if db name is not specified in dsn
Details
| Submitted | 2006-02-18 23:52 UTC |
|---|---|
| From | brammeleman at brammeleman dot org |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 5.0.4 |
| OS | Mac OS X 10.4.5 |
| Roadmaps | (Not assigned) |
Comments
[2006-02-18 23:52 UTC] brammeleman at brammeleman dot org
Description:
------------
When I forget to specify a db name in the dsn, I get no error
messages when trying to insert data into a table.
Test script:
---------------
require_once 'DB.php';
// note: no db specified in dsn
$dsn="mysql://dbuser@localhost";
$db =& DB::connect($dsn);
if(PEAR::isError($db)) {
die('failed to connect to db');
}
$sth = $db->prepare('INSERT INTO tablename (data) VALUES (?)');
$data = "test";
$db->execute($sth, $data);
if(PEAR::isError($db)) {
die('failed to insert data');
}
Expected result:
----------------
failed to insert data
Actual result:
--------------
no output and no records inserted