php mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thomasvt28
Forum Newbie
Posts: 10
Joined: Tue Aug 05, 2014 4:02 am

php mysql

Post 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
thomasvt28
Forum Newbie
Posts: 10
Joined: Tue Aug 05, 2014 4:02 am

Re: php mysql

Post by thomasvt28 »

i used if loop inside the while loop...is that the problem??
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: php mysql

Post 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
“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

Post 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??
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: php mysql

Post 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?
“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

Post 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
thomasvt28
Forum Newbie
Posts: 10
Joined: Tue Aug 05, 2014 4:02 am

Re: php mysql

Post by thomasvt28 »

please reply as soon as possible
Post Reply