Page 1 of 1

problem with php+mysql

Posted: Fri Oct 24, 2008 4:52 am
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.

Re: problem with php+mysql

Posted: Fri Oct 24, 2008 5:11 am
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.

Re: problem with php+mysql

Posted: Fri Oct 24, 2008 10:02 am
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";

Re: problem with php+mysql

Posted: Sat Oct 25, 2008 7:10 am
by Oren
Did you check your function without ajax?