Javascript While Loop Syntax Php Database Code