|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ini_set('include_path', '~/pear/lib' . PATH_SEPARATOR . ini_get('include_path'));
// From PHP 4.3.0 onwards you can use, especially useful on a shared host set_include_path('~/pear/lib' . PATH_SEPARATOR . get_include_path()); require_once("Classes/DB.php"); $dbType = "mysql"; $dbUser = "Test"; $dbPass = "test"; $dbServer = "localhost"; $dbName = "Sale"; $db = DB::connect("$dbType://$dbUser:$dbPass@$dbServer/$dbName"); if(DB::isError($db)) { die("Couldn't connect to database"); } else { $query = "SELECT test FROM Test"; $uResult = $db->query($query); while ($uRow = $uResult->fetchRow()) { echo $uRow[0] . " => " . $uRow[1] . "\n"; } $db->disconnect(); } ?> I already install pear DB package on shared web host but when i run phpinfo page i get include_path=".:/usr/lib/php:/usr/local/lib/php" And when i run my page it get the error as unable to connect database. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > Unable to connect database using DB in shared web hosting |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|