ptolomea Posted October 19, 2007 Share Posted October 19, 2007 I'm trying to retrieve an image from my database, the code i have works for anything with out a space but once there is a space in a title it only sends the first word. I have tried str_replace, and addslashes to no avail. request for image. getImage.php?title='" . $title . "'> getImage.php $title = $_REQUEST['title']; mysql_select_db("movies"); $results = mysql_query("SELECT * FROM currentlist WHERE title = '" . $title . "'"); while ($row = mysql_fetch_array($results)){ echo $row['coverFront']; } Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/ Share on other sites More sharing options...
hvle Posted October 19, 2007 Share Posted October 19, 2007 $title = urlencode($title); getImage.php?title='" . $title . "'> Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/#findComment-372852 Share on other sites More sharing options...
Wes1890 Posted October 19, 2007 Share Posted October 19, 2007 ^ you posted the same thing as me lol Also, i would try to avoid using $_REQUEST. I hear it's not a good security idea. Stick to $_POST or $_GET depending on what it is. Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/#findComment-372855 Share on other sites More sharing options...
ptolomea Posted October 19, 2007 Author Share Posted October 19, 2007 thats sending it now but still unable to load image thought it was because of the + that were now added but adding urldecode still didn't show the image. even threw decode into a new variable same result. $newTitle = urldecode($title); $results = mysql_query("SELECT * FROM currentlist WHERE title = '" . $newTitle . "'"); Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/#findComment-372867 Share on other sites More sharing options...
hvle Posted October 19, 2007 Share Posted October 19, 2007 what exactly the error that you got? Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/#findComment-372871 Share on other sites More sharing options...
ptolomea Posted October 19, 2007 Author Share Posted October 19, 2007 i'm not actually getting an error, just a broken image link, but when i type the information in the browser window i'm able to see that it is in fact grabbing an image from the database and that it is in fact searching the right title. which makes me think that this problem is not related to the original problem. edit: getImage.php?title='" . $title . "'> problematic little single quotes. changed to getImage.php?title=" . $title . "> works just fine Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/#findComment-372877 Share on other sites More sharing options...
hvle Posted October 19, 2007 Share Posted October 19, 2007 broken image link, Check the image link to see if it point to the valid img file and go from there. Quote Link to comment https://forums.phpfreaks.com/topic/73890-solved-white-space-problem/#findComment-372878 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.