urbandsigns.com Posted May 22, 2006 Share Posted May 22, 2006 Ok new to PHP. I've done this before with MSSQL but having a hard time in php. [code]select (case when collectionImg = '' then '' else '<img src=' collectionImg '><br>' end) as collectionImg[/code]Basically I want it to check to see if there is a collectionImg. If there is, build the html for me, if not do nothing. Everything works except it doesn't display the collectionImg variable. How do I need to format that part (collectionImg) to get it to work? Link to comment https://forums.phpfreaks.com/topic/10200-need-help-with-mysql-case-statements/ Share on other sites More sharing options...
Barand Posted May 22, 2006 Share Posted May 22, 2006 The posted code is SQL, not PHP. So where does PHP come into the frame? Link to comment https://forums.phpfreaks.com/topic/10200-need-help-with-mysql-case-statements/#findComment-38034 Share on other sites More sharing options...
urbandsigns.com Posted May 22, 2006 Author Share Posted May 22, 2006 Good point. Meant to say new to PHP and MySql. Now how about some help? Link to comment https://forums.phpfreaks.com/topic/10200-need-help-with-mysql-case-statements/#findComment-38086 Share on other sites More sharing options...
willpower Posted May 22, 2006 Share Posted May 22, 2006 $image= "my variable from the sql query"if ($img<>"") {do this } Thats pretty much it...a simple conditional statement. Link to comment https://forums.phpfreaks.com/topic/10200-need-help-with-mysql-case-statements/#findComment-38091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.