HADI_EN
Registered User
- تاریخ عضویت
- 20 مارس 2006
- نوشتهها
- 242
- لایکها
- 2
من يه كد با كلاس pear براي ارتباط با db نوشتم به اين صورت :
ولي يه Error از كلاس DB به اين شكل داد مشكل چي هستش؟
کد:
<?php
// Include the PEAR DB library.
require_once "DB.php";
// Use PEAR DB's ODBC driver as the backend.
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_name = 'epro';
$stmt = "SELECT * FROM aa";
$dsn = "mysql://$db_user:$db_pass@unix+$db_host/$db_name";
// Create a new DB connection object and connect to the ODBC database.
$dbh =& DB::connect($dsn);
if (DB::isError($dbh)) {
die("Unable to connect to database: " . $dbh->getMessage() . "\n"
. $dbh->getDebugInfo() . "\n");
}
// Use the database connection object to execute a SQL query.
$sth =& $dbh->query($stmt);
if (DB::isError($sth)) {
die("Unable execute query: " . $sth->getMessage() . "\n"
. $sth->getDebugInfo() . "\n");
}
// Retrieve each row from the DB result object.
while ($row =& $sth->fetchRow()) {
print_r($row);
}
// Release the result set.
$sth->free();
// Close the connection object.
$dbh->disconnect();
?>
ولي يه Error از كلاس DB به اين شكل داد مشكل چي هستش؟
کد:
Fatal error: Cannot redeclare class db in F:\xampp\php\pear\DB.php on line 433