Answer the question
In order to leave comments, you need to log in
How to store math expressions in a MySQL table and then do calculations with PHP?
I need to store mathematical expressions in which field for each record in the table, and then sum them up using PHP
. For example,
ID| Title |Expression
where Expression can take the values +1, -2, +5, -6 , that is, valid operands are [-,+]Integer. The task then to summarize these values with grouping.
The first thing that comes in is a VARCHAR[8] field, that is, as a string.
1. Is there a more beautiful solution for storing mathematical operations in a table?
2. How then to sum up the field values beautifully using PHP or SQL?
Answer the question
In order to leave comments, you need to log in
www.w3schools.com/sql/sql_func_sum.asp
Store simply as signed integers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question