Home > Backend Development > PHP Tutorial > 怎么利用PHP将从数据库中读取的数据保存再变量中

怎么利用PHP将从数据库中读取的数据保存再变量中

WBOY
Release: 2016-06-13 11:30:37
Original
1357 people have browsed it

怎样利用PHP将从数据库中读取的数据保存再变量中?
利用echo $myrow1[xm_name];可以输出项目名称,利用echo $myrow2[zf];可以得到项目的总分,可是如何在php中将其保存在变量中呢?$xm_name=$myrow1[xm_name];和$xm_zf=$myrow2[zf];两句中变量echo后无结果。

$query1=mssql_query("select * from tb_xm where xm_pcid='$xmpc_id'");	<br />	while($myrow1=mssql_fetch_assoc($query1)){<br />		echo $myrow1[xm_name];<br />                $xm_name=$myrow1[xm_name];/***************/<br />		$query2=mssql_query("select sum(xmpf_small_zf) as zf from tb_xmpf where xmpf_xm='$myrow1[xm_name]'");			<br />		//echo $query2;<br />		echo "总分:";<br />		while($myrow2=mssql_fetch_assoc($query2)){<br />		 echo $myrow2[zf];<br />                 $xm_zf=$myrow2[zf];<br />		 }<br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template