作者:米斯特RAO | 来源:互联网 | 2017-05-14 02:21
php中的function函数,不会用呢我的一个one.php页面下:<?phpinclude("conn.php");$rsmysql_query(" ( selectop_valuesfromtable1whereop.id11 )union (&
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 codewhile($row=mysql_fetch_array($rs)){ // echo "$row[op_values]
"; //如果只是为了传值就不用输出 $arr[]= $row[op_values]; }