日期:2014-05-17  浏览次数:20560 次

php 中的function函数,不会用呢
我的一个one.php页面下:
<?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]<br/> ";
 
  }
 
 ?>


two.php页面下:
<?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];

 }