problem with php+mysql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
orninyo
Forum Newbie
Posts: 10
Joined: Fri Oct 24, 2008 4:46 am

problem with php+mysql

Post by orninyo »

hi
i built a simple function that get a string of a username ,search the db and check if it exsist.
the problem is when i enter an hebrew string (of a username that exist in db)
the function in IE returen that it isnt exist and on FF it works fine (return true - the user exsist)
(when i enter an english username the function forks fine for the both of the browser)
all my pages encoded as utf-8 including my db.

what seems to be the problem?

thx.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Re: problem with php+mysql

Post by Oren »

Weird... if it works in Firefox it should work with IE as well. I doubt it would help, but... show us your code.
orninyo
Forum Newbie
Posts: 10
Joined: Fri Oct 24, 2008 4:46 am

Re: problem with php+mysql

Post by orninyo »

the function uses ajax so ill copy only the relevant lines:
calling the function:

Code: Select all

<input type="text" onblur="checkuser(this.value)" name="username" dir='rtl' size="15" />
js file:

Code: Select all

function checkuser(t)
{
    searchdb(t);
}

Code: Select all

function searchdb(name)
{
    http.open('get', 'searchdb.php?user='+name);   
    http.onreadystatechange = handleResponse;
    http.send(null);
}
searchdb.php:

Code: Select all

        $query="SELECT * FROM 
        users WHERE (username = '$_GET[user]'
        )";
        $result=mysql_query($query);
        $row = mysql_fetch_array($result, MYSQL_NUM);
        if($row[0])
            echo "1";
        else
            echo "0";
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Re: problem with php+mysql

Post by Oren »

Did you check your function without ajax?
Post Reply