$result function = having trouble making a table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
warriors2003
Forum Commoner
Posts: 38
Joined: Wed Mar 24, 2004 7:24 pm

$result function = having trouble making a table

Post by warriors2003 »

trying to make a table from using the $result function, having trouble getting the data to feed in where I need to go. Major props to Mark last night who helped me with the below code. I never used the Result function, and having trouble figuring out how it feeds into a table here is my code


TABLE JUNK IS HERE IS HERE


<?
// Display requested entries
while ( $row = mysql_fetch_array($result))

{
echo "<tr><td bgcolor=CCCCCC>$row[against]</td><td bgcolor=CCCCCC>$row[ab]</td><td bgcolor=CCCCCC>$row[h]</td><tr><td bgcolor=CCCCCC>$row[hr]</td><td bgcolor=CCCCCC>$row[rbi]</td><td bgcolor=CCCCCC>$row[doubles]</td><tr><td bgcolor=CCCCCC>$row[triples]</td><td bgcolor=CCCCCC>$row[r]</td><td bgcolor=CCCCCC>$row[sb]</td></tr>";
}
?>
-----------------------------------------------

I'm guessing there is soemthing wrong in the echo. I am trying to get the data to fill out all on one line, then the next set of data for that ID right udner it,,,it is coming out all messed up like this

http://www.becauseitscool.com/hitplayer.php?hit_id=55

Thanks in advance
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

You just need to remove the extra <tr>'s in there.
So you'de end up with something like,
echo "<tr><td> ... </td><td> ... </td> etc..etc.. </tr>";
warriors2003
Forum Commoner
Posts: 38
Joined: Wed Mar 24, 2004 7:24 pm

Post by warriors2003 »

GOOD CATCH MY FRIEND!! YOU DA MAN!!!
Post Reply