Displaying commas some how automatically when numbers coming from a database

Hi there,

I am developing a a snippet for my facebook application and i have the the following numbers in the database they are 1769,1359,1643,1753 Now those are the same when they get displayed on the page but when i want to display it by this format like this 1,769 and 1,359 and 1,643 and 1,753

ive tried using for loop but not sure if i am doing it correctly


for($i=0; $i>9; $i++)
				{
					//
					echo "".$i."";
					for($t=000; $t>999; $t++)
					{
						//
						$q="".$i.",".$t."";
						echo $q;
						$r="update players set Units=$q";
						echo $r;
						$rs=mysqli_query($con,$r);
						if(!$rs)
						{
							$er=mysqli_error($con);
							echo "Error".mysqli_error($con);
							$adminemail="demonhunterds@hotmail.com";
							$email="demonhunterds@hotmail.com";
							mail($email,"Error","Error is $er","From:$adminemail");							
						}
						else
						{
							$adminemail="demonhunterds@hotmail.com";
							$email="demonhunterds@hotmail.com";
							mail($email,"New Units","New units have been added on your facebook game","From:$adminemail");
						}
							//
					}
						//
				}	

http://php.net/manual/en/function.number-format.php