topical media & game development

talk show tell print

basic-php-03-select2-rev03.php / php



  <?php
  //connect to MySQL
  connect = mysql_connect("localhost", "bp5am", "bp5ampass") 
    or die("Hey loser, check your server connection.");
  
  //make sure we're using the right database
  mysql_select_db("moviesite");
  
  query = "SELECT movie_name, movietype_label " .
           "FROM movie " .
           "LEFT JOIN movietype " .
           "ON movie_type = movietype_id " .
           "WHERE movie.movie_year>1990 " .
           "ORDER BY movie_type";
  results = mysql_query(query)
    or die(mysql_error());
  
  echo "<table border=\"1\">\n";
  while (row = mysql_fetch_assoc(results)) {
    echo "<tr>\n";
    foreach(row as value) {
      echo "<td>\n";
      echo value;
      echo "</td>\n";
    }
    echo "</tr>\n";
  }
  echo "</table>\n";
  ?>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.