Forum Moderators: coopster & phranque

Message Too Old, No Replies

mySql and operators

How to do simple sums!

         

cyclic

3:00 pm on Nov 2, 2002 (gmt 0)

10+ Year Member



I have a lot of data in a mySql database, allof which is numerical. Is there a way of performing simple operators to the records to produce a new record. My mySql book mentions simple +-/*% operators but then doesn't say how to apply them. Are these only for queries from the mySql prompt?

I just want to take the input integers, perform an operation on them and return a new result.

My next question is about forms! Is the only way to input to php/mysql through a form as I am trying to reproduce a spreadsheet type affair but I am creating way to many variables at the moment.

martin

5:03 pm on Nov 2, 2002 (gmt 0)

10+ Year Member



SELECT a + 5 AS sum FROM my_table;

>Is the only way to input to php/mysql through a form as I am trying to reproduce a spreadsheet type affair

You can try importing from a CSV file.

jatar_k

7:04 pm on Nov 2, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try here

MySQL Numeric Functions [mysql.com]

cyclic

10:19 pm on Nov 2, 2002 (gmt 0)

10+ Year Member



Thanks Martin + Jatar

I have found the numerical functions, it was putting them into use! Is it true to say that most functions can be used in this manner?

jatar_k

10:43 pm on Nov 2, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>>used in this manner

Sorry, I am not sure exactly what you mean cyclic. What manner?

The documentation has examples of how all of the functions are used. I thought it was better than me trying to explain it. ;)