Classes With Friends (myclasses.php)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. include ('connect.php');
  3.  
  4. $fid = $_GET['id'];
  5.  
  6. $query = "SELECT Distinct enrollment.className, users.name FROM enrollment INNER JOIN users ON enrollment.fid = users.fid INNER JOIN class ON enrollment.className = class.className where users.fid ='".$fid."'";
  7.  
  8. //$query = "SELECT FROM enrollment w fid ='".$fid."'";
  9. $title = 0;
  10. $result = mysql_query($query)or die(mysql_error());
  11.  
  12. while($row = mysql_fetch_array($result) or die(mysql_error()))
  13. {
  14.  
  15.  
  16. if($title == 0)
  17. {
  18. echo "<h1>".$row['name']."'s Classes!</h1>";
  19. echo "<ol>";
  20. $title++;
  21. }
  22.  
  23. echo "<li>".$row['className']."</li>";
  24.  
  25. }
  26. echo "</ol>";
  27.  
  28. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.