1

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

1 Answer 1

4
$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 );
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.