[prog] php & mysql

wolf wolf at wolfrising.net
Tue Feb 24 19:21:24 EST 2004


Hi, I'm trying to make a nice looking room chart that shows where 
classes are held, which room number, what class, and so on.
I have this query that I was given:

$query_Recordset1 = "select room_code, UPPER(c.title) AS course_title, 
f.l_name, schedule, bin(schedule + 0) as binsched, schedule + 0 as test 
from section s, course c, faculty f";
$query_Recordset1 .= " where s.c_code = c.c_code and s.f_code_inst = 
f.f_code and term='fall' and year=2003  order by s.c_code";  

and so far this php code:
<table border="1">
   <tr>
     <td>Room</td>
     <td>Course Code</td>
     <td>Faculty Code</td>
     <td>Schedule</td>

   </tr>
   <?php do { ?>
   <tr>
     <td><?php echo $row_Recordset1['room_code']; ?></td>
     <td><?php echo $row_Recordset1['course_title']; ?></td>
     <td><?php echo $row_Recordset1['l_name']; ?></td>
     <td><?php echo $row_Recordset1['schedule']; ?></td>
	
   </tr>
   <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>  

which produces a page that looks like this:

Room     Course Code   Faculty Code                        Schedule
14               ACCT I            Wilt                    
Mon/3,Tue/3,Wed/3,Thu/3,Fri/3


what I'd like the code to do is produce a table that looks more like 
this:

______________________Period 3______________________________

Room     Mon                 Tues                   Wed              
Thur                  Fri

    14        ACCT I             ACCT I               ACCT I             
ACCT I         ACCT I
                    Wilt                   Wilt                       
Wilt                    Wilt               Wilt


does anyone happen to see a way I could either re-write the query or a 
way to re-write the php code so that the table would
appear like the second example?

Thank you : )



More information about the Programming mailing list