piro Posted January 7, 2009 Share Posted January 7, 2009 hi all I have a database that returns a number with <?php echo $i; ?> what i would like to do, is take that number and show an image instead example. if $i == 1 then show image.png if $i == 2 then show image.png etc etc i have looked around but i dont see anything that matches, or even anything that is close. thanks piro Quote Link to comment https://forums.phpfreaks.com/topic/139886-phpmysql-if-statement-image-help/ Share on other sites More sharing options...
premiso Posted January 7, 2009 Share Posted January 7, 2009 <?php switch ($i) { case 1: echo '<img src="image1.png" />'; break; case 2: echo '<img src="image2.png" />'; break; } ?> There is the basis of the logic. Quote Link to comment https://forums.phpfreaks.com/topic/139886-phpmysql-if-statement-image-help/#findComment-731857 Share on other sites More sharing options...
piro Posted January 7, 2009 Author Share Posted January 7, 2009 thank you very much Presiso, i will try it. Quote Link to comment https://forums.phpfreaks.com/topic/139886-phpmysql-if-statement-image-help/#findComment-731904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.