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


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 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.


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, 9 Months ago Karma: 0
Brilliant, cheers.
The administrator has disabled public write access.
 
#47910
Re:Show image if Bool value =1 10 Years, 9 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, 9 Months ago Karma: 760
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