我正在尝试使用一个ini文件,其中包含要在oracle sql查询中使用的windowspc名称列表。
我能够检索ini中的值,但是当我尝试使用查询中的值时,我得到了 注意:第22行的C:\ xampp \ htdocs \ MachineJob.php中的数组到字符串转换
当我将查询包含在我得到的while请求中时 警告:第16行的C:\ xampp \ htdocs \ MachineJob.php中的非法字符串偏移'WINDOWS'
警告:第16行的C:\ xampp \ htdocs \ MachineJob.php中的非法字符串偏移'MACHINE2' 甲
<?php
include 'oracon.php';
$i =1;
$win = parse_ini_file('machines.ini',true);
while($i <= 27){
echo $win['WINDOWS']['MACHINE'.$i] ;
$i++;
}
$query1 = ('select * from v$session where terminal = :win');
$result1 = oci_parse($conn, $query1);
oci_bind_by_name($result1, ':win', $win);
oci_execute($result1);
$query2 = oci_parse($conn, 'select m.machinename, j.workorderid, j.qtytoproduce, startdate, j.progressreport from job j, machine m where j.status <>600 and j.machineid = m.machineid');
oci_execute($query2);
$row1 = oci_fetch_array($result1);
echo "<table>
<tr class=\"TableHeading-CSS\">
<th class=\"TableHeading-CSS\">Machine Name</th>
<th class=\"TableHeading-CSS\">Workorder</th>
<th class=\"TableHeading-CSS\">QTY</th>
<th class=\"TableHeading-CSS\">Started</th>
<th class=\"TableHeading-CSS\">Progress</th>
<th class=\"TableHeading-CSS\">Operator</th>
</tr>";
while($row2 = oci_fetch_array($query2)){
echo "<tr class=\"Table-CSS\">";
echo "<td class=\"Table-CSS\">" . $row2['MACHINENAME'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['WORKORDERID'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['QTYTOPRODUCE'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['STARTDATE'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row2['PROGRESSREPORT'] . "</td>";
echo "<td class=\"Table-CSS\">" . $row1['USERNAME'] . "</td>";
echo "</tr>";}
echo "</table>";
?>
机器内容
[WINDOWS]
MACHINE1 = FHMTESTDC01-JMS
MACHINE2 = FHMDC0002-JMS
MACHINE3 = FHMDC0003-JMS
MACHINE29 =FHMDC0029-JMS
[DBNAME]
MACHINE1 = TESTDC01
MACHINE2 = DC9k02
MACHINE3 = DC9k03
etc