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
#47880
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 0
Brilliant, cheers.
The administrator has disabled public write access.
 
#47910
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 0
sorry, I know it's not your job to troubleshoot SQL, but if you can help me with this, I can't get this to work: I'm getting "no data available". here's my statement;


select *
IF(col17=1, "<img src= \"www.mysite.com/images/red.png\", "<img src= \"www.mysite.com/images/blue.png\")
FROM table1, table2 where table1.ID = table2.id




I've tried changing "col17=1" to "mycolumnname=1" as well

tried different ways to write the img src statement as well, using ' and ".

What am I missing here? Is the "if" in thye right place?

Thank you so much!
The administrator has disabled public write access.
 
#47912
Re:Show image if Bool value =1 10 Years, 4 Months ago Karma: 748
It should contains column name, for example if columns name is "enabled", use the following query:

Code:


SELECT
  T1.*,
  T2.*,
  IF(enabled=1, '<img src="http://www.mysite.com/images/red.png" />', '<img src="http://www.mysite.com/images/blue.png" />') AS Icon
FROM 
  table1 T1, 
  table2 T2 
WHERE 
  T1.ID = T2.id



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