如何在jqGrid中设置数据源

我试图使用jqGrid,我得到一个致命的错误

致命错误:C:\ xampp \ htdocs \ psnm \ grid \ grid.php中带有“无效数据源名称”消息的未捕获exception“PDOException”:8堆栈跟踪:

0 C:\ xampp \ htdocs \ psnm \ grid \ grid.php(8):PDO – > __ construct(’localhost’,’root’,”)#1

C:\ xampp \ htdocs \ psnm \ electionadmin.php(40):include(’C:\ xampp \ htdocs …’)#2 {main}抛出C:\ xampp \ htdocs \ psnm \ grid \ grid。第8行的PHP

grid.php第8 grid.php

 $conn = new PDO("localhost",root,""); 

我在localhost服务器我的数据库名称是psnm ,用户是root ,没有密码,任何人都可以帮我找出问题…

PDO的构造函数需要dsn作为第一个参数。 看下面的语法:

 PDO::__construct() ( string $dsn [, string $username [, string $password [, array $driver_options ]]] ) 

有关更多信息,请参阅PHP 手册 。