topical media & game development

talk show tell print

server-mysql-code-ch17-examples.txt / txt



  
  /* Chapter 17 - Examples */
  
  while(row = mysql_fetch_array(result))
  {
     cdId = row["CDID"];
     cdName = row["CDName"];
     inStock = row["InStock"];
     onOrder = row["OnOrder"];
     reserved = row["Reserved"];
     department = row["Department"];
     category = row["Category"];
     printf("cdId, cdName, inStock, onOrder, reserved, department, category");
  }
  
  if((strlen(department) !=0) && (strcmp(department, "Classical")==0))
  {
     printf("The cdName CD is classified as category.");
  }
  
  abbreviatedName = substr(firstName, 0, 1) . ". " . 
                     substr(middleName, 0, 1) . ". " . lastName;
  
  printf(abbreviatedName);
  
  if(strcmp(_POST["department"], "Classical") == 0)
  {
     header("Location: ClassicalSpecials.php");
     exit;
  }
  
  if (strcmp(_POST["department"], "Classical") == 0)
  {
     include <ClassicalSpecials.php>;
  }
  
  deleteSql = "DELETE FROM CDs WHERE CDID = 10";
  
  mysql_query(deleteSql, link);
     or die("Invalid query: " . mysql_error(). "<br>".deleteSql);
  
  


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