www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Query with an accent

  1. #1
    Join Date
    May 2009
    Posts
    235

    resolved [RESOLVED] Query with an accent

    I have a query to search for a name in a directory but there is an accent in the name and is not returning any results.

    PHP Code:
    $query "SELECT * FROM directory WHERE name=\"$name\""
    if I echo this I get:

    SELECT * FROM directory WHERE name="Lorquet, Sébastien"

    This returns nothing.

    In the database the name is as is and I checked this. It finds all other data except for the two entries that have an accent.

    I have also tried putting this code in

    PHP Code:
    header ('Content-type: text/html; charset=utf-8');
    include(
    "../connectdb.php");
    mysql_set_charset("utf8"); 

    but then I get the following results: Lorquet, SĂ©bastien

    I have also tried changing the setting in the table to utf8_general_ci and it still did not work.
    Last edited by beylah; 03-31-2014 at 11:42 AM.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,334
    If you are using MySQL, here is some info I collected on the subject: http://www.ebookworm.us/utf8-in-php-and-mysql/
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    May 2009
    Posts
    235
    I have added this and it now works

    $name=utf8_decode($rows['name']);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles