topical media & game development

talk show tell print

basic-php-03-select-rev02.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, movie_type " .
           "FROM movie " .
           "WHERE movie_year>1990 " .
           "ORDER BY movie_type";
  results = mysql_query(query)
    or die(mysql_error());
  
  while (row = mysql_fetch_assoc(results)) {
    foreach (row as val1) {
      echo val1;
      echo " ";
    }
    echo "<br>";
  }
  ?>
  


(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.