Results 1 to 2 of 2

Thread: [RESOLVED] MySQL, Query with umaluts and other special Chars return emtpy results

  1. #1

    Thread Starter
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Resolved [RESOLVED] MySQL, Query with umaluts and other special Chars return emtpy results

    This one has been kicking me for the last couple of days... and it's starting to tick me off... I've got some queries that I need to run via PHP against a mySQL database. For the most part, the queries work OK... the only time they don't seem to want to is when there are special characters in the search string.

    I've got it printing out the sql, and when I then copy that sql and use it in the mySQL Query Browser, it returns the correct results.

    Code:
    	$SAMQuery = "SELECT songlist.artist, album, label, count(trackno) as trackcount, albumyear FROM songlist  
    					INNER JOIN categorylist ON songlist.ID = categorylist.songID
    					INNER JOIN category ON categorylist.categoryID = category.ID 
    					WHERE (category.name = 'Current Tracks') AND (songlist.songtype='S') AND (songlist.artist = '".$artistName."') 
    					GROUP BY songlist.artist, album, label, albumyear
    					ORDER BY album";
    	
    	$SAMdb->open($SAMQuery);
    That's the code I'm using to call the query.... if I use "queen" .. as the $artistName, then I get back results correctly -- all albums by Queen. BUT, if I use "Queensrÿche" ... the results are empty... and I should get 1 result. I've also found this to happen if I'm searching for something with an ampersand in it too....

    Is there something I'm missing?

    If you want to see it in action try this link ... you'll get the resutls for a search on "queen" ... there's two links, one for Queen that returns results, and one for Queensrÿche that claims to return no results (should return 1).

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  2. #2

    Thread Starter
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: [RESOLVED] MySQL, Query with umaluts and other special Chars return emtpy results

    I found the problem... it was staring me right in the face the whole time. I forgot I had wrapped the get fuynction that returns the data with the htmlentities function ... the results of which was then passed through url_encode .... once I dropped the call to htmlentities, and used only the url_encode function, all became right with the world again.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width