0

What i'm trying to do seemed simple but I'm struggling to get it to work.

What I would like is to fetch a comparison operator from mysql and use in PHP but it doesn't seem to work at the moment.

I currently have the below:

if($currentDebtRatio.$row['operator'].$row['value'])    {echo "Test"}

This outputs as:

0>2

The problem is that the text displays even though the criteria doesn't appear to have been met.

If I hard code as:

if($currentDebtRatio > $row['value'])   {echo "Test"}

Then it isn't displayed.

Is it possible to store operators in mysql?

Haribo83
  • 155
  • 2
  • 13
  • $currentDebtRatio. '>' .$row['value'] works for me!!! – BhAvik Gajjar Jan 30 '20 at 08:50
  • Does this answer your question? [PHP parse string as condition operator](https://stackoverflow.com/questions/22218263/php-parse-string-as-condition-operator). Also see [Using a variable as an operator](https://stackoverflow.com/questions/2263311/using-a-variable-as-an-operator). – showdev Jan 30 '20 at 08:52
  • @showdev perfect - thanks – Haribo83 Jan 30 '20 at 09:01

0 Answers0