Spread Evenly

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ek5932
Forum Commoner
Posts: 25
Joined: Mon Jun 28, 2004 5:55 pm

Spread Evenly

Post by ek5932 »

When the user enters a number into the text feild i want the numbers to be spread evenly into 24 fields. Here is my code

Code: Select all

while ($land > 0)
{
if ($i > 24)
{
$i = 1;
}
$land = $land - 1;
mysql_query("UPDATE users SET eh$i=eh$i+1 WHERE username = '". $_SESSIONї'username'] . "'");
$i = $i + 1;
}
It works fine when a user enters 25 the extra number will be on the left and I need it on the right, is there any way i can set it to the extra number is on the right?

eg

not: 2 1 1 1 1 1 1 1 1 ect

but: etc 1 1 1 1 1 1 1 1 2

Any help would be much apreciated, thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your update is set to crowd everything left sided..
Post Reply