为什么PHP代码失败,代码试图做什么? [英] Why is the PHP code failing and what is the code trying to do?

查看:71
本文介绍了为什么PHP代码失败,代码试图做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简要描述这段PHP代码正在做什么以及代码中缺少的内容

会导致代码失败。



Briefly describe what this PHP code is doing and what is missing from the code
that will cause the code to fail.

list($tsql,$nkeys) = sqrySelectAclUsersMini();
$recordset = sqlsrv_query($conn, $tsql);

if( $conn ) {
     if ( $recordset === false){
        die( print_r( sqlsrv_errors() ) );
     }
     while ($row = sqlsrv_fetch_array($recordset)) {
        print ("\n" );
        $person_id = $row["person_id"];
        foreach($nkeys as $field) {
	   switch ($field) {
	      case "person_id":
	           break;
	      case "full_name":
	           $full_name = ucwords(str_replace("_"," ",$row[$field]));
	           print ("<a href="".$person_id.".html" id="".person_id."">".$full_name."</a>");
	           break;
	   default:
	   	   print ("$row[$field]");
   	   }
        }
        print ("\n");
     }
}else{
   echo "Connection could not be established.".$conn."<br>";
   die( print_r( sqlsrv_errors()));
}


function sqrySelectAclUsersMini(){
/*--------------------------------------
Query pulling All Persons from Login.dbo.tbl_acl_users
--------------------------------------*/
Return array ("
      SELECT person_id
	,netid
	,cn as full_name
	,eppn
      FROM Login.dbo.tbl_acl_users
      WHERE active=1
      ORDER BY full_name",
	array("person_id"
	,"netid"
	,"full_name"
	,"eppn")
      );
}





我的尝试:



我已经尝试识别代码正在做什么以及缺少什么。



What I have tried:

I have tried identifying what the code is doing and what is missing.

推荐答案

tsql,


nkeys)= sqrySelectAclUsersMini();
nkeys) = sqrySelectAclUsersMini();


recordset = sqlsrv_query(
recordset = sqlsrv_query(


这篇关于为什么PHP代码失败,代码试图做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆