Echo数组行作为变量sqlserver

问题描述:

I have a problem that I think i understand the issue but I'm stuck for a resolution.

I have a sql query running in PHP as follows:

$sql = "select COUNT(*) From dbo
Where dbo.table.STATUS < 4";

$Backlog = sqlsrv_query($conn,$sql);
if( $Backlog === false) {
    die( print_r( sqlsrv_errors(), true) );
}
while( $Row = sqlsrv_fetch_array( $Backlog, SQLSRV_FETCH_NUMERIC) ) {
      echo $Row[0];
}

My connection to the source is fine and if I put this out via a basic PHP page I get the result of the query printed on the page.

However, I'm trying to call $Backlog on a different page with some CSS formatting:

<?php echo "<div class =second_row_label>Incident Back Log</div><div class =top_num>".$Backlog."</div></div></a>"; ?>

And it's here I'm getting the Resource ID #x error.

From scanning the various pages I believe $Backlog is my resource so the question is, how can I call the result as the variable $Backlog on the second sheet?

我有一个问题,我认为我理解这个问题,但我坚持要求解决。 p>

我在PHP中运行的SQL查询如下: p>

  $ sql =“从dbo中选择COUNT(*)
其中dbo.table.STATUS  &lt; 4“; 
 
 $ Backlog = sqlsrv_query($ conn,$ sql); 
if($ Backlog === false){
 die(print_r(sqlsrv_errors(),true)); 
} \  nwhile($ Row = sqlsrv_fetch_array($ Backlog,SQLSRV_FETCH_NUMERIC)){
 echo $ Row [0]; 
} 
  code>  pre> 
 
 

我与源的连接很好 如果我通过一个基本的PHP页面把它拿出来,我会得到页面上打印的查询结果。 p>

但是,我正在尝试使用一些CSS格式在另一个页面上调用$ Backlog: p>

 &lt;?php echo“  &lt; div class = second_row_label&gt;事件返回日志&lt; / div&gt;&lt; div class = top_num&gt;“。$ Backlog。”&lt; / div&gt;&lt; / div&gt;&lt; / a&gt;“;  ?&gt; 
  code>  pre> 
 
 

在这里,我收到了资源ID #x错误。 p>

从扫描各个页面 我相信$ Backlog是我的资源所以问题是,如何在第二张表中将结果作为变量$ Backlog调用? p> div>

If I understand your question correctly I think sessions will solve your problem.

Store your values to $_SESSION variables. You can then use those $_SESSION variable on any page that includes session_start()