PHP mssql错误
在使用mssql模块时,我从php中得到以下错误PHP mssql错误,php,Php,在使用mssql模块时,我从php中得到以下错误 PHP Warning: mssql_query(): message: Incorrect syntax near 'i'. (severity 15) in /var/www/html/inc/get_port.php on line 19 PHP Warning: mssql_query(): General SQL Server error: Check messages from the SQL Server (severity 1
PHP Warning: mssql_query(): message: Incorrect syntax near 'i'. (severity 15) in /var/www/html/inc/get_port.php on line 19
PHP Warning: mssql_query(): General SQL Server error: Check messages from the SQL Server (severity 15) in /var/www/html/inc/get_port.php on line 19
PHP Warning: mssql_query(): Query failed in /var/www/html/inc/get_port.php on line 19
问题是:
$query = "SELECT i.NodeID as \"NodeID\" i.InterfaceName as \"Int Name\", i.Caption, i.InterfaceAlias as InterfaceAlias, i.IfName, nd.IP_Address as \"IP Address\", nd.Caption as \"Node Name\", nd.Location, nd.machinetype From [Interfaces] as \"i\", [NodesData] as \"nd\" where i.NodeID = nd.NodeID and (nd.MachineType LIKE \"CISCO CATALYST%\" OR nd.MACHINETYPE LIKE \"PROCURVE%\") and (nd.Location LIKE \"F208%\" and i.InterfaceAlias = \"E26\") ";
有什么不喜欢我的标签的提示吗?此命令最初运行时在mssql服务器上运行正常
SELECT i.NodeID as "NodeID", i.InterfaceName as "Int Name", i.Caption, i.InterfaceAlias as InterfaceAlias, i.IfName, nd.IP_Address as "IP Address", nd.Caption as "Node Name", nd.Location, nd.machinetype From [Interfaces] as i, [NodesData] as nd where i.NodeID = nd.NodeID and (nd.MachineType LIKE 'CISCO CATALYST%' OR nd.MACHINETYPE LIKE 'PROCURVE%') and (nd.Location LIKE 'F208%' and i.InterfaceAlias = 'E26' )
直接在MSSQL服务器上执行的查询在第二个
i
旁边有逗号,而在PHP中执行的查询没有逗号
$query = "SELECT i.NodeID as \"NodeID\" <- there should be a comma here
$query=“选择i.NodeID作为\“NodeID\”如果在\“NodeID\”之后缺少一个逗号,请尝试使用'
而不是\”
,这将使您的生活更轻松“当最初在mssql服务器上运行此命令时,它可以正常工作”现在打印出$query
,并用眼睛比较两者。。。