Reply
Displaying MySQL Information In Rows
Old 02-22-2005, 01:24 AM Displaying MySQL Information In Rows
Logical Program's Avatar
Super Talker

Posts: 130
Location: Atlanta, Georgia
I see many website that display galleries and whatnot in rows of 4 or rows of 10 and whatnot... Example:


_ _ _ _ _ _
_ _ _ _ _ _
_ _ _ _ _ _
Next Page >

I'm an avid PHP programmer, and I just can't think of a way of how to do it... The logic behind this type of looping... Could anyone explain the logic to me? I think this could come in handy...
__________________
Logical Programming - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.

Last edited by Logical Program : 02-22-2005 at 01:33 AM.
Logical Program is offline
Reply With Quote
View Public Profile Visit Logical Program's homepage!
 
When You Register, These Ads Go Away!
Old 02-22-2005, 01:38 AM
Skilled Talker

Posts: 62
Start out with a variable equal to zero.
Loop through your script and add one to the variable each time.
If it's equal to four, print </tr><tr>.
That way it will start a new row

Good luck!
-Jason
The Jasong is offline
Reply With Quote
View Public Profile
 
Old 02-22-2005, 01:50 AM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Hey, logical program, the link in your sig is some kind of virus or hack. Maybe you're not aware of it, but it attempts to do something with AIM and a screen name of "Illicit Criminal." It attempts to say, "You've been owned by Illicit Criminal." If you're not the one who did this, you've definitely been hacked and are possibly spreading it to other people.
__________________
Free Teacher Websites

Last edited by Phaedrus : 02-22-2005 at 01:52 AM.
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 02-23-2005, 02:00 AM
Logical Program's Avatar
Super Talker

Posts: 130
Location: Atlanta, Georgia
Phaedrus, I was testing an AIM crash script for someone, and I accidentally uploaded the PHP index file to the root directory... Sadly, I program in a style in which my whole website is in one file, the index. I had no backups... So, that sucks. :-/
__________________
Logical Programming - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.
Logical Program is offline
Reply With Quote
View Public Profile Visit Logical Program's homepage!
 
Old 02-24-2005, 08:11 PM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
Just make a counter, and every X number of times, insert a new row.

PHP Code:
$count 1;
while(
$row mysql_fetch_array($res))
{
    if(
$count++ % == 0)
        echo 
'</tr><tr>';

    
// ...

This will print a row of 5 items (new rows when $count / 5 with a remainder of 0 -- thus, every 5 times).
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Reply     « Reply to Displaying MySQL Information In Rows
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13827 seconds with 12 queries