PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 2nd, 2003, 02:30 PM
djkkenny djkkenny is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 djkkenny User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
php table help??

hi im really new to php developing, i have this tabel written in PHP, but i have no idea on how to customize it...
----------------------------------------------------------------------
PHP Code:
<table cellpadding='3' cellSpacing='2' width='350'>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo  "
<tr valign='top'><td><font face="Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#FFCC00\"><b><a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]&forum=$row[forum_id]\">" .
$row["topic_title"] .
"</a></td></font></b><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\"> by: <a href=\"$urlPath/profile.php?mode=viewprofile&u=$row[user_id]\">" .
$row["username"] .
"</td><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\">" .
date('F j, Y, g:i a'$row["post_time"]) .
"</td></tr></font>";
}
print 
"</table> 

---------------------------------------------------------------
thats the code i have, and basically i want to different colour backgrounds to each row, and if possible have one column with a picture on each row...

i also need to have a set width for each column... i would appreciate any feeback or help you can give!!

thanks very much in advance.

Reply With Quote
  #2  
Old August 3rd, 2003, 09:15 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
djkkenny,

Customizing it can be done in various ways... I don't know exactly how much you want to customize it..

As for alternating the row colours, what you can do is perform a calculation using the modulus (%) operator, which will determine which row colour to use on each row:

PHP Code:
 $i 0;
while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {

// This determines the row colour to use
if (($i 2) == 0){
   
$colour "background-color='#ffffff'";
else {
   
$colour "background-color='#ff0000'";
}

echo  
"<tr valign='top'><td><font face="VerdanaArialHelveticasans-serif" size=\"1\"><font color=\"#FFCC00\" [b]$colour[/b]><b><a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]&forum=$row[forum_id]\">" 
...
// end of while 


That will give you alternating row colours...

I would, however, suggest using CSS (Cascading Style Sheets) rather than hard-coding your colour/style values directly in your html tags.

HTH!
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #3  
Old August 4th, 2003, 07:09 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
It sounds like maybe you need to find a quick HTML primer for these very basic questions.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > php table help??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway