DoggerWatson Posted May 24, 2006 Share Posted May 24, 2006 Outline:I'm trying to get the results from a MySQL database & display them.Just usingFROM `books` WHERE image_by LIKE '%".$_GET ['artistID')."%' AND (books.Image_Sml != '/images/thumbs/NoImage_th.jpg' )";Will not differentiate between <a href="http://site1.biz/'>name1</a>and <a href="http://site2.com/'>name2</a>Gives me erroneous results, but works if the returned value is not an URLSO I searched through the forum& figured that I needed to use htmlspecialchars as per belowNOW I get no results returned at all$linkID = mysql_connect('localhost', 'Lida', 'ttb1lq') or die( "Error, database not accessing!"); mysql_select_db('twihjlight',$linkID); $query = "SELECT books.Id, books.Titles, books.image_by, books.Image_SmlFROM `books` WHERE image_by LIKE '%".htmlspecialchars($_GET ['artistID'])."%' AND (books.Image_Sml != '/images/thumbs/NoImage_th.jpg' )"; if(! $result = mysql_query($query, $linkID)) echo mysql_error($linkID); //cry if the query fails Quote Link to comment https://forums.phpfreaks.com/topic/10331-problem-with-_get/ Share on other sites More sharing options...
predator12341 Posted May 24, 2006 Share Posted May 24, 2006 why dont you just store the get statement into a variable then bobs ya uncle it will be doneso do $searchtext = $_GET['Your-Thing-Here']sql statement select * from Blah WHERE name =' $searchtext'and that should get ya going Quote Link to comment https://forums.phpfreaks.com/topic/10331-problem-with-_get/#findComment-38511 Share on other sites More sharing options...
DoggerWatson Posted May 24, 2006 Author Share Posted May 24, 2006 Thanks for the prompt response, but it still doesnt answer why<a href="http://site1.biz/'>Name1</a><a href="http://site2.biz/'>Name2</a>appear to return the same values wherasname3 worksThese are to populate a select list with values from the DBwhich then displays the images associated with them Quote Link to comment https://forums.phpfreaks.com/topic/10331-problem-with-_get/#findComment-38515 Share on other sites More sharing options...
predator12341 Posted May 24, 2006 Share Posted May 24, 2006 Hey i aint full understanding your problemare you tring to send data through the URL or what Quote Link to comment https://forums.phpfreaks.com/topic/10331-problem-with-_get/#findComment-38527 Share on other sites More sharing options...
DoggerWatson Posted May 24, 2006 Author Share Posted May 24, 2006 [!--quoteo(post=376629:date=May 24 2006, 06:24 AM:name=predator12341)--][div class=\'quotetop\']QUOTE(predator12341 @ May 24 2006, 06:24 AM) [snapback]376629[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hey i aint full understanding your problemare you tring to send data through the URL or what[/quote]Maybe this might make it clearerThese first two produce the desired result:value in DB= John Jones[a href=\"http://twilighttimes-publications.biz/catalogue2.php\" target=\"_blank\"]http://twilighttimes-publications.biz/catalogue2.php[/a]?[b]artistID=John[/b]&Submit=Govalue in DB= Judith Warr[a href=\"http://twilighttimes-publications.biz/catalogue2.php\" target=\"_blank\"]http://twilighttimes-publications.biz/catalogue2.php[/a]?[b]artistID=Judith[/b]&Submit=GoThese two don't workvalue in DB= <a href="http://www.site1.com/">Peter Smith</a>[a href=\"http://twilighttimes-publications.biz/catalogue2.php\" target=\"_blank\"]http://twilighttimes-publications.biz/catalogue2.php[/a]?[b]artistID=%3Ca[/b]&Submit=Govalue in DB= <a href="http://www.site2.com/">Joe Bloggs</a>[a href=\"http://twilighttimes-publications.biz/catalogue2.php\" target=\"_blank\"]http://twilighttimes-publications.biz/catalogue2.php[/a]?[b]artistID=%3Ca[/b]&Submit=Go Quote Link to comment https://forums.phpfreaks.com/topic/10331-problem-with-_get/#findComment-38717 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.