从mssql提取数据时,第0行请求的未知参数'4'

时间:2018-08-17 07:20:26

标签: php sql-server

通过php从数据库中获取数据时,出现以下错误。

enter image description here

下面是sql查询

pipeline.apply("PubsubIO", PubsubIO.readProtos(clazz).fromSubscription(options.getSubscriptionId()))
                            .apply(ParDo.of(new PBTransFormFn()))
                            .apply(Window.<String>into(FixedWindows.of(parseDuration(options.getWindowDuration()))))
                            .apply(TextIO.write().withWindowedWrites()
                                    .to(new GCSFileNamePolicy(options.getGcsBasePath(), options.getFileNamePrefix(), options.getFileNameSuffix()))
                                    .withTempDirectory(FileBasedSink.convertToFileResourceIfPossible(options.getTempDirectory()))
                                    .withNumShards(options.getNumShards()));

下面是在数据表中显示的PHP代码。

SELECT dbo.ASD_Employees.firstname,dbo.ASD_Employees.lastname,dbo.ASD_InOutType.description,dbo.ASD_InOutTrans.textarea_desc,dbo.ASD_InOutTrans.trans_date,dbo.ASD_InOutTrans.trans_time FROM dbo.ASD_InOutTrans INNER JOIN dbo.ASD_Employees ON dbo.ASD_Employees.code=dbo.ASD_InOutTrans.employee_code INNER JOIN dbo.ASD_InOutType ON dbo.ASD_InOutType.code=dbo.ASD_InOutTrans.inouttype_code WHERE dbo.ASD_InOutTrans.employee_code=$u_4_digit AND dbo.ASD_InOutTrans.inouttype_code=$action_go AND dbo.ASD_InOutTrans.trans_date = '".$date_f."'"

问题是我有一个搜索表单,想要显示多个搜索条件。我还有另外五个带有日期的搜索查询,所以我在php中使用的功能正常工作。我得到所有结果,但所有日期,而不是解析后的else if((isset($_POST['date_from'])) && (isset($_POST['4_digit'])) && (isset($_POST['move_type']))){ //An ta exw ola $date_from = $_POST['date_from']; $u_4_digit = $_POST['4_digit']; $action_go = $_POST['move_type']; $date_seperator= multiexplode(array("-"," "),$date_from); $date_f = $date_seperator[0]; $time_f = $date_seperator[1]; $date_t = $date_seperator[5]; $time_t = $date_seperator[6]; date_default_timezone_set("Europe/Athens"); $date= date("j/n/Y"); $qrr = ("SELECT dbo.ASD_Employees.firstname,dbo.ASD_Employees.lastname,dbo.ASD_InOutType.description,dbo.ASD_InOutTrans.textarea_desc,dbo.ASD_InOutTrans.trans_date,dbo.ASD_InOutTrans.trans_time FROM dbo.ASD_InOutTrans INNER JOIN dbo.ASD_Employees ON dbo.ASD_Employees.code=dbo.ASD_InOutTrans.employee_code INNER JOIN dbo.ASD_InOutType ON dbo.ASD_InOutType.code=dbo.ASD_InOutTrans.inouttype_code WHERE dbo.ASD_InOutTrans.employee_code=$u_4_digit AND dbo.ASD_InOutTrans.inouttype_code=$action_go AND dbo.ASD_InOutTrans.trans_date = '".$date_f."'"); $result = sqlsrv_query($conn,$qrr); $count = 0; while($row = sqlsrv_fetch_array($result,SQLSRV_FETCH_NUMERIC)){ ?> <tr> <td><?php echo $row[0]." ".$row[1]; ?></td> <td><?php echo $row[2]; ?></td> <td><?php echo $row[4]." / ".$row[5]; ?></td> <td><?php echo $row[3]; ?></td> <td><?php echo $date_f." ".$u_4_digit." ".$action_go;?></td> </tr> <?php } } } ?>

0 个答案:

没有答案