Skip to content
Advertisement

How can I replace boolean values in a table, imported from a MYSQL database, with a custom string?

I have a php script for an admin panel that shows if a device is broken or not. But it (of course) only displays 1’s and 0’s. I want to make it more user friendly by replacing a 0 with “broken” and a 1 with “working”.

I didn’t try anything yet because I don’t got a single clue on how to “fix” my problem. Here is the code of my admin panel:

JavaScript

The header “Beschädigt?” is containing the boolean “rueck_damage” from the MYSQL database, which currently only shows 1’s and 0’s. How do I convert those 1’s and 0’s to “working” or “broken” in my table? I want the data in my database to stay a boolean. Thanks for your help!

Advertisement

Answer

if i understood you correct , if the value is 1 show working or 0 then broken ?

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement