Quote:
Originally Posted by johnsully517
Hi everyone. I'm new at this and was just wondering if you could point me in the right direction.
I'm selling tickets on a website. On a database I have saved how many tickets each person wants.
I want to create a page that displays that number of tickets. So if the database says a person wants 5 tickets, I want 5 tickets to appear (an image, a table, or whatever) and I want them numbered 1-5.
How do you recommend I start going about this? With loops? An array? Again, I'm pretty new.
Thanks!
|
You can use a loop - either 'while' or 'for'. If you are using a MySQL database you can use the 'while' loop as such;
$query = mysql_query("SELECT * FROM table");
$count = 1;
while ($result = mysql_fetch_assoc($query)) {
echo "This is ticket number " .$count;
$count++;
}
That's the basics of it, how you format it (either using images or in tables) is completely up to you. (Does that help?)
Last edited by EdB; 02-19-2009 at 07:34 AM..
|