Jiraiya Posted April 21, 2009 Share Posted April 21, 2009 im trying to display a image that is stored as a url in my database how would i retreive the image url in the database but have it show the image?? Link to comment https://forums.phpfreaks.com/topic/155092-need-help/ Share on other sites More sharing options...
rondog Posted April 21, 2009 Share Posted April 21, 2009 query the database and select your image. Then write your image like: <img src="<?php $row['imgpath']; ?>" /> Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-815805 Share on other sites More sharing options...
Jiraiya Posted April 21, 2009 Author Share Posted April 21, 2009 what should the url be stored as in the database a char?? Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-815806 Share on other sites More sharing options...
mrMarcus Posted April 21, 2009 Share Posted April 21, 2009 varchar (255) should suffice. Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-815808 Share on other sites More sharing options...
alphanumetrix Posted April 21, 2009 Share Posted April 21, 2009 Yeah, varcahr 255 probably would 'suffice'. However, make sure your image URL's don't exceed 255 characters. If they do, it won't work. Maybe instead of varchar, you should go with full_text. Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-815818 Share on other sites More sharing options...
mrMarcus Posted April 21, 2009 Share Posted April 21, 2009 Yeah, varcahr 255 probably would 'suffice'. However, make sure your image URL's don't exceed 255 characters. If they do, it won't work. Maybe instead of varchar, you should go with full_text. that would be one heck of a filename i just threw out varchar (255) 'cause it's seems to be a pretty standard field attribute. you should always rename files anyways .. less errors with funky filenames, and also keeps things unified. Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-816001 Share on other sites More sharing options...
premiso Posted April 22, 2009 Share Posted April 22, 2009 Maybe instead of varchar, you should go with full_text. For a URL? Wow dude, that has to be some of the worst advice. The only reason to use Full Text is for searching long entries, like in a forum or blog. No other reason to use it. For a URL Varchar(255) will be more than enough. If their URL is longer than 255 characters, then something is wrong with that URL. Even a proxy url is not that long. Stick with the Varchar for the URL, not the full_text. And honestly, even 255 is a bit extensive, but you would be safe with that. Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-816035 Share on other sites More sharing options...
Mchl Posted April 22, 2009 Share Posted April 22, 2009 There is no such datatype as full_text in MySQL... It's an index property (and it's FULLTEXT actually) And maximum length for VARCHAR is 65536 since MySQL 5.0.3... Link to comment https://forums.phpfreaks.com/topic/155092-need-help/#findComment-816352 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.