Welcome Guest, Not a member yet? Register   Sign In
Request check user availability CodeIgniter jquery example code
#9

[eluser]jiahui[/eluser]
halo, Richard.

I got question again. Hope you can help me too.
This time I'd like to connect database (controller) to check the availability status. In order to do that I changed my code as the following:

Code:
$this->db->where('username', $username);
$query = $this->db->get('user');
        
if ($query->num_rows() == 0)
{
    echo "yes";
}
else
{
    echo "no";
}

It doesn't work...

But if I write the coding in this way, it can be worked. Could you tell me what's the problem it is?

Code:
$SQL="select * from user where username='".$username."'";
$rs = mysql_query($SQL) or die(mysql_error());
                
if(mysql_num_rows($rs) > 0)
{
        echo "no";
}
else
{
    echo "yes";
}


Messages In This Thread
Request check user availability CodeIgniter jquery example code - by El Forum - 10-23-2009, 01:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB