up vote 1 down vote favorite

i have an ajax script that check if the user name is available or not, but it keeps taking the newest user name and the rest are out

$result = mysql_query("Select username from customer");

while ($row = mysql_fetch_array($result)){

$existing_users=array(''.$row['username'].',');     
}

i know i am doing something worng

flag

1 Answer

up vote 2 down vote accepted
$result = mysql_query("select username from customer");

$existing_users = array();

while ($row = mysql_fetch_array($result)){  
   $existing_users[] = $row[ 'username' ];
}

$csv_array = implode( ',', $existing_users );
link|flag
Your a life saver thank you, worked like a charm – Mahmoud May 5 at 1:20
You're welcome. – Jacob Relkin May 5 at 1:22
Also, please accept the answer so the question gets moved out of the 'Unanswered' section. – Jacob Relkin May 5 at 1:22

Your Answer

get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.