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
- Red Squirrel
- Posts: 29209
- Joined: Wed Dec 18, 2002 12:14 am
- Location: Northern Ontario
- Contact:
Smiley's
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
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
Honk if you love Jesus, text if you want to meet Him!
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: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
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