[PHP] alternating row color--newbie help

2004-04-15 Thread Montagna, Dan
Hi everyone,
 
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\TDsid/TDTDleague/TDTDday/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']./TDTD.$row['phonenumber']./TDTD.$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] drop down list not populating

2004-01-27 Thread Montagna, Dan
Hi
 
I've got the code for a drop down list and the drop down box displays--but
with no info in it.  The underlying table is populated so I could use some
advice on what might be wrong from here
 
SELECT
  ?
include(includes/db.php);
 
MYSQL_CONNECT(HOST,USER,PASS) OR DIE(Unable to connect to database); 
@mysql_select_db(DB) or die( Unable to select database);
 
$query=(select * from community order by community);
 
$result=mysql_query($query) or die (Unable to Make the Query: .
mysql_error() ); 
 
while($row=mysql_fetch_array($result)){ 
 
echo OPTION VALUE=.$row['community']./OPTION;
}
?
/SELECT
 
Any ideas?
 
Thanks
 
Dan
 


[PHP] generate drop down list from DB and display info on new page base d on selection

2004-01-20 Thread Montagna, Dan
Hello,
 
I'm new to php/mysql and have been looking for help on this for a little
while.  I've searched around a bit but can't find anything close enough to
what I'm talking about here.  I want to create a drop down list from a mysql
db table (I know how to create and populate the table) that displays one
field [community] .  Then I'd like to select the community, submit my
selection and bring up a listing of projects for that community on a new
page.  The concept to me doesn't seem that difficult and something like this
must be posted somewhere...If anyone can either get me started or point me
at an example it would be really helpful.  Thanks
 
Dan