Page 1 of 1
php mysql
Posted: Thu Aug 07, 2014 1:33 am
by thomasvt28
I used while loop to retreive values from database..i used it many times..
But today using it, it returns all the values but repeating the last value 4 times
Re: php mysql
Posted: Thu Aug 07, 2014 1:37 am
by thomasvt28
i used if loop inside the while loop...is that the problem??
Re: php mysql
Posted: Thu Aug 07, 2014 2:08 am
by social_experiment
Welcome to the forum
It will help your cause if you can supply some code that is related to the problem - it will greatly increase chances of your problem getting solved
Re: php mysql
Posted: Thu Aug 07, 2014 2:38 am
by thomasvt28
i have columns a,b in my database with datats...i retreived it using while loop...
My question is, i want to multiply column a and column b for each row...how to do this??
Re: php mysql
Posted: Thu Aug 07, 2014 2:56 am
by social_experiment
social_experiment wrote:It will help your cause if you can supply some code...
^ no code sir?
how did you store the values you retrieved?
Re: php mysql
Posted: Thu Aug 07, 2014 3:30 am
by thomasvt28
a | b | rate
500 1000 2%
2500 5000 4%
above is my database table
Code: Select all
$select=mysqli_query($mysqli,"select * from tbl");
while($row=mysqli_fetch_array($select,MYSQLI_ASSOC))
{
if($status=='Single')
{
$a=$row13['a'];
$b=$row13['rate'];
}
elseif($status=='Married')
{
$a=$row13['a'];
$b=$row13['rate'];
}
else
{
// $personal_exempti
}
$final=$a * $b/100;
}
this is my code..i have to find each rows % value..please help
Re: php mysql
Posted: Thu Aug 07, 2014 5:17 am
by thomasvt28
please reply as soon as possible