adzie Posted May 7, 2007 Share Posted May 7, 2007 how can I display an image if a field for a user shows a 1 Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/ Share on other sites More sharing options...
Lokolo Posted May 7, 2007 Share Posted May 7, 2007 if ( field = 1 ) { display image } else { don't display image } Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/#findComment-247521 Share on other sites More sharing options...
fenway Posted May 7, 2007 Share Posted May 7, 2007 how can I display an image if a field for a user shows a 1 How is this an sql question? Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/#findComment-247547 Share on other sites More sharing options...
adzie Posted May 7, 2007 Author Share Posted May 7, 2007 appologies fenway can you move this to the php, I posted in a rush sorry lokolo where would I put a link to and image in that short script? thanks Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/#findComment-247554 Share on other sites More sharing options...
Lokolo Posted May 7, 2007 Share Posted May 7, 2007 ok if you have the url in a field then thats all good set the url to a variable so like $url then do the regular image thing with HTML so like <img src="$url"> (I think) so if ( field = 1 ) { <img src="$url"> } else { echo "you do not have priviledges to have a picture"; } ; Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/#findComment-247562 Share on other sites More sharing options...
adzie Posted May 7, 2007 Author Share Posted May 7, 2007 thanks lokolo i'm looking to have various fields dictating which group a member belongs to, ie 1 if they are 0 if not. so i want it to display a image dependent on the group. Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/#findComment-247568 Share on other sites More sharing options...
adzie Posted May 9, 2007 Author Share Posted May 9, 2007 $query = "SELECT flights.IMAGE INTO FLIGHT_IMAGE FROM members, flights WHERE flights.FLIGHT = members.FLIGHT AND members.VID = VID"; This is the code I've been given to extract an image dependent on the user ID an example of table below members table VID -- this identifies the person FLIGHT -- The group they belong to flight table FLIGHT -- the flight group IMAGE -- the url to the image. now assumin this works how can I get the image to display on the screen next to my form fields and will this code pick the correct image for the group? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/50390-display-image-if-field/#findComment-249130 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.