读书人

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

发布时间: 2012-04-07 17:31:51 作者: rapoo

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]; } 

读书人网 >PHP

热点推荐