Jump to content

doing math from database


Jaynesh

Recommended Posts

Hello

 

I'm working on something very basic.

 

I've created a few tables with some information and I'm having them all displayed using this code.

 

 while( $i < $row = mysql_fetch_array($myfeed_query))
  {
  echo (number will go here)
  echo $row['post'] . "<br>";
  echo $row['username'] . "<br>";
  }

 

In each row I've also got 2 columns each containing a number.

How do I subtract number1 from number2 and have the result displayed beside each query?

Link to comment
https://forums.phpfreaks.com/topic/241381-doing-math-from-database/
Share on other sites

solved it. here it is if anyone is stuck too.

 

  while( $i < $row = mysql_fetch_array($friendfeed_query))
  {
  $number1 = $row['number1'];
  $number2 = $row ['number2'];
  $number3 = $number1 - $number2;
  echo $number3;
  
  echo $row['post'] . "<br>";
  echo $row['username'] . "<br>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.