变量值不在while循环上分配 [英] Variable values are not assigning on a while loop

查看:112
本文介绍了变量值不在while循环上分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应该从mysql数据库获取值的while循环,这些值应该使用while循环添加,但它不能像我预期的那样工作。所有我需要将colom费用值添加到我使用while循环声明的变量。



我尝试过:



< pre><?php 
$ E03F1 =E03F1;
$ E03F2 =E03F2;
$ E03F3 =E03F3;
$ E03F4 =E03F4;
$ E03F5 =E03F5;
$ E03F6 =E03F6;
$ Fee1 =;
$ Fee2 =;
$ Fee3 =;
$ Fee4 =;
$ Fee5 =;
$ Fee6 =;

$ X = 1;

include('db.php');
while($ X< = 6)
{

$ result = mysqli_query($ con,SELECT * FROM toll_fees where feecode ='$ E03F [$ X]' );

while($ row = mysqli_fetch_array($ result))
{
$ Fee [$ X] = $ row ['fee'];
}
mysqli_close($ con);
$ X ++;
}
?>

解决方案

E03F1 =E03F1;


E03F2 =E03F2;

E03F3 = E03F3;

i have a while loop that should get values from a mysql database, those values should add using a while loop, However its not working as i expected. all i need to add colom fee values to the variables that i have declared using a while loop.

What I have tried:

<pre><?php
$E03F1="E03F1";
$E03F2="E03F2";
$E03F3="E03F3";
$E03F4="E03F4";
$E03F5="E03F5";
$E03F6="E03F6";
$Fee1="";
$Fee2="";
$Fee3="";
$Fee4="";
$Fee5="";
$Fee6="";

$X=1;

include('db.php');
while($X<=6)
{
   
   $result=mysqli_query($con,"SELECT * FROM toll_fees where feecode='$E03F[$X]'");
    
    while ($row=mysqli_fetch_array($result))
    {
        $Fee[$X]=$row['fee'];
    }
    mysqli_close($con);
    $X++;
}
?> 

解决方案

E03F1="E03F1";


E03F2="E03F2";


E03F3="E03F3";


这篇关于变量值不在while循环上分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆