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
php mysql
Moderator: General Moderators
-
thomasvt28
- Forum Newbie
- Posts: 10
- Joined: Tue Aug 05, 2014 4:02 am
Re: php mysql
i used if loop inside the while loop...is that the problem??
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: php mysql
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
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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
-
thomasvt28
- Forum Newbie
- Posts: 10
- Joined: Tue Aug 05, 2014 4:02 am
Re: php mysql
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??
My question is, i want to multiply column a and column b for each row...how to do this??
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: php mysql
^ no code sir?social_experiment wrote:It will help your cause if you can supply some code...
how did you store the values you retrieved?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
-
thomasvt28
- Forum Newbie
- Posts: 10
- Joined: Tue Aug 05, 2014 4:02 am
Re: php mysql
a | b | rate
500 1000 2%
2500 5000 4%
above is my database table
this is my code..i have to find each rows % value..please help
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
-
thomasvt28
- Forum Newbie
- Posts: 10
- Joined: Tue Aug 05, 2014 4:02 am
Re: php mysql
please reply as soon as possible