0
I’m making a Mysql query in which one of the columns would be the result of a calculation.
However, I need to check in PHP if this account is valid. For example, Pow(-0.2,0.5) would be an impossible value because it would be the same as trying to take the square root from a negative value. I have a problem too that in this field does not necessarily need to be an account, it may only come as the name of some table column.
I thought about using Eval(), but it gives error for every time I do not enter an account but the name of a column.
Is there any way to validate if it’s a possible calculation and, if it’s any name, do nothing?
EX: select Pow(-0.2,0.5),columnA,colunaB from Tabela1 Where name="John" would result in error since the first account is impossible. But it may come in the following format: select Pow(colunaA,colunaB),colunaA,colunaB from Tabela1 Where name="John" and in that case, it would not be necessary to make a check if it is a valid account.
Can you show a little code? would be easier to understand the question..
– M. Bertolazo
could check with an is_numeric the result, but then, even though it is a enorm fraction, it would be pointed out as true.
– Michel Simões
Using is_numeric I believe it will not work pq using is_numeric(Eval('Return'.$account.';')) it holds true even though it is an impossible account
– Christian