Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Show image if Bool value =1
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Show image if Bool value =1
#47816
Show image if Bool value =1 10 Years, 4 Months ago Karma: 0
Just what the title says. I have a BOOL sql value, and I want the table to show an image if BOOL value = 1.
I understand "if" statements can't be put in Format column. How do I do this? Many thanks, Again!
The administrator has disabled public write access.
 
#47836
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 748
Hello,

Do you show data from a database?

Regards,
ARI Soft
The administrator has disabled public write access.
 
#47849
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 0
Yes, from "external database" (via mysql)
The administrator has disabled public write access.
 
#47850
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 748
A possible solution is using IF function to format value directly.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#47859
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 0
Any way you can give an example of this?

Let's say I have a Top 10 Players, a table that includes a boolean value ("is the player red?").

Is it possible to include in the SQL statement somewhere an IF statement that says, "if the BOOL value is '1', show a red icon". Else, show the blue icon"
I can do it in PHP, but I haven't a clue how to get it into the SQL query.
The administrator has disabled public write access.
 
#47872
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 748
For example use something like this:

SELECT
IF(col1 = 1,'images/red.jpg','images/blue.jpg')
FROM
tbl


or


SELECT
IF(col1 = 1,'<img src="images/red.jpg" />','<img src="images/blue.jpg" />')
FROM
tbl


Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 12