Page 1 of 1
Smiley's
Posted: Tue Dec 13, 2005 10:42 am
by C_daley98
i have to make a program that asks the user how many smiley's they would like and they push show smiley's and it should show how ever many smiley's they chose.
My problem is i don't know how to draw 2 smiley's if they pick 2, or if they pick 90 how can i make it draw that many smiley's
Archived topic from Iceteks, old topic ID:4019, old post ID:33012
Smiley's
Posted: Tue Dec 13, 2005 12:49 pm
by Red Squirrel
What is this with? php I'm guessing? You could make it so the number they enter is part of the sql limit query so when they hit submit it would do something like:
mysql_query("SELECT * FROM smileytable LIMIT ".$number.";");
$number should be filtered to ensure it IS a number, but given this is just for school and not an actual application I doubt you have to bother, unless they specified it has to be secure.
If you don't use sql you can still use a file database and just use a counter variable to go through each entry then stop at the specified number.
Archived topic from Iceteks, old topic ID:4019, old post ID:33015
Smiley's
Posted: Tue Dec 13, 2005 1:58 pm
by Death
C_daley98 wrote: i have to make a program that asks the user how many smiley's they would like and they push show smiley's and it should show how ever many smiley's they chose.
My problem is i don't know how to draw 2 smiley's if they pick 2, or if they pick 90 how can i make it draw that many smiley's
Counted loop with the condition being the number of smileys they want. For example, if they choose 99 smileys, the loop runs while the condition is increment < 99. If you're using turing, then it would be something like:
for i (1..99)
end for
I believe, haven't programmed that in a awhile. That way, for every increment in the loop, u draw a smiley (Not sure if you want it to draw randomly or what not).
Archived topic from Iceteks, old topic ID:4019, old post ID:33020