Home >Backend Development >PHP Tutorial >php 中的function函数,不会用呢解决思路

php 中的function函数,不会用呢解决思路

WBOY
WBOYOriginal
2016-06-13 10:10:081002browse

php 中的function函数,不会用呢
我的一个one.php页面下:
include("conn.php");
$rs=mysql_query("
 (
  select op_values from table1 where op.id=11
  )union
 ( 
  select op_values from table2 where op.id=12
)
   
 
 while($row=mysql_fetch_array($rs))
{  
echo "$row[op_values]
";
 
  }
 
 ?>


two.php页面下:
include("conn.php");

define('ID_OUTPUT_VOLTAGE', 31);
define('ID_OUTPUT_CURRENT', 35);

$V = getProductAttributes(ID_V, $p_id);
$A = getProductAttributes(ID_A, $p_id);

function getProductAttributes(){
这里面不会写呢,想把sql的两个值op_values给弄过来,echo 出来


}

然后w=V*A;




------解决方案--------------------

PHP code
while($row=mysql_fetch_array($rs)){      // echo "$row[op_values]<br> ";  //如果只是为了传值就不用输出     $arr[]= $row[op_values]; }<div class="clear">
                 
              
              
        
            </div>
Statement:
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