SQL quary?

RastaLulz

fight teh power
Staff member
May 3, 2010
3,934
3,933
You'd execute something along the lines of the following query:
Code:
SELECT `id` FROM `user_table` WHERE `username` = '<username>' LIMIT 1
Then you'd check the number of rows it returns, and if returns one or more, then the username exists.
 

Proximity

IDK?
Feb 13, 2014
673
56
Code:
function check_availability(){  

//get the username  

var username = $('#rUsername').val();  

//use ajax to run the check  

$.post("./users/php/site/user/check", { username: username },  

function(result){  

if(result == 1){  

$('#username_availability_result').html('<span style="color:green">Username: <b>' + username + '</b> is available!</span>');  

}

else

{  

$('#username_availability_result').html('<span style="color:red">Username: <b>' + username + '</b> is taken!</span>');  

}  

});  

}

that is my script It check /users/php/site/user/check/index.php and runs to see if its available.
 

Hindi

System.out.println(" ");
Dec 30, 2012
989
193
Code:
function check_availability(){

//get the username

var username = $('#rUsername').val();

//use ajax to run the check

$.post("./users/php/site/user/check", { username: username },

function(result){

if(result == 1){

$('#username_availability_result').html('<span style="color:green">Username: <b>' + username + '</b> is available!</span>');

}

else

{

$('#username_availability_result').html('<span style="color:red">Username: <b>' + username + '</b> is taken!</span>');

}

});

}

that is my script It check /users/php/site/user/check/index.php and runs to see if its available.
From what its seen, Looks like a Habbo staff page where it checks if the staff member is online or not, If yes the status bar goes green and if not, turns red.

Nevertheless, I am assuming you are wanting to check if the user is online via DB Query right?
If that's the case use this query

Code:
SELECT users.username FROM users where users.online = 1;
 
Last edited:

Users who are viewing this thread

Top