开发者

want to use Doctrine DBAL

I want to use Doctrine DBAL , I downloaded the DBAL folder from a site. and put the folder on my server . and then write this code in my file .

use Doctrine\Common\ClassLoader;

require 'Doctrine/Common/ClassLoader.php';

$classLoader = new ClassLoader('Doctrine', 'Doctrine');
$classLoader->register(); 


$config = new \Doctrine\DBAL\Configuration();
//..
$connectionParams = array(
    'dbname' => 'mydb',
    'user' => 'user ',
    'password' => 'password',
    'host' => 'host',
    'driver' => 'pdo_mysql',
);
$conn = DriverManager::getConnection($connectionParams);
$stmt = $conn->query($select_resellerData);
    $fetch = $stmt->fetch();
print_r($fetch); 

is giving me this error .

Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home/abhijitnair/sandbox/resel开发者_如何学JAVAler dashboard/manual_population/populatenew.php on line 3

Please suggest what i need to use dbal.

Thanks


If the error is from the line on "use", then the error is most likely because you don't have PHP 5.3 or later installed (or in use). Namespaces were introduced in 5.3 so any earlier version would not recognize the word "use" as a language keyword to indicate the used namespace. The parse error is most likely caused, because the dated PHP version thinks that "use" is a function and it's expecting a ( after the function name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜