Are you sure there is data in "name, phonenumber, age" ??


> Well, I've hit all the forums and tried it a few different ways, but I
> still
> can't get this code to work.  At this point it just shows me an empty
> table
> with column headings.  I am new and still experimenting, but can someone
> tell me what is wrong here?  This is pretty much straight from a tutorial,
> with just a few mods for my purposes.  Here's what it looks like online:
>
> http://www.enfieldrollerhockey.com/EDH/html/testing/alt_rows3.php
> <http://www.enfieldrollerhockey.com/EDH/html/testing/alt_rows3.php>
>
> and the code:
>
> <?php
> $db = mysql_connect("*************","********","*********") or
> die("Problem
> connecting");
> mysql_select_db("hockeystats") or die("Problem selecting database");
> $query = "SELECT * FROM mon_roll_de ORDER BY sid";
> $result = mysql_query($query) or die ("Query failed");
> //let's get the number of rows in our result so we can use it in a for
> loop
> $numofrows = mysql_num_rows($result);
> ?>
>
> <?php
> echo "<TABLE BORDER=\"1\">\n";
> echo "<TR
> bgcolor=\"lightblue\"><TD>sid</TD><TD>league</TD><TD>day</TD></TR>\n";
> for($i = 0; $i < $numofrows; $i++) {
>     $row = mysql_fetch_array($result); //get a row from our result set
>     if($i % 2) { //this means if there is a remainder
>         echo "<TR bgcolor=\"yellow\">\n";
>     } else { //if there isn't a remainder we will do the else
>         echo "<TR bgcolor=\"white\">\n";
>     }
>     echo
> "<TD>".$row['name']."</TD><TD>".$row['phonenumber']."</TD><TD>".$row['age'].
> "</TD>\n";
>     echo "</TR>\n";
> }
> //now let's close the table and be done with it
> echo "</TABLE>\n";
> ?>
>
> I'd appreciate any hints on this...
>
> Thanks
>
> Dan
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to