Tuesday, June 26, 2018

Lecture 5. SQL Cont.- Building Dynamic Websites HarvardOpencourseWare. CS75

Video: Lecture 5 SQL Cont.. (Youtube link to open in a new window)

Run Time:1:42:34

HarvardOpencourseWare. CS75 (Summer 2012)





Course Web Site by CS75.tv
Course Sillabus (Opens in a PDF)

Course Sections Lead By TA
Course Projects
The course's own website is at www.cs75.net.
Google Discussion Group


Lecture 0: HTTP
Lecture 1: PHP
Lecture 2: PHP, Continued
Lecture 3: MVC, XML
Lecture 4: SQL
Lecture 6: JavaScript
Lecture 7: Ajax
Lecture 8: Security
Lecture 9: Scalability

htaccess-guide - how-to-use-htaccess

















=====================================
The yahoo finance URL format that this lecture used has been changed. So the URL supplied in the lecture is not longer working.

I experimented with the fgetcsv() function with the following three example codes;

/* Experimenting with fgetcsv() function #1

<?php
   $row=1;
   $num=0;
   $url = "http://~~~~~~/sample2.csv";
 if (($handle = fopen($url, "r")) !==FALSE) {
   while (($data = fgetcsv($handle, 100, ",")) !== FALSE) {
      $num = count($data);
      echo "<p> $num fields in line $row: <br /></p>\n";
      
      $row++;
      for ($c=0; $c < $num; $c++) {
         echo $data[$c] . "<br />\n";
      }
   }
   
   fclose($handle);
   }
?>

/* Experimenting with fgetcsv() function #2

<?php
$row = 1;
if (($handle = fopen("http://~~~~~~~~~/test.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 100, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
    }
    fclose($handle);
}

?>

/* Experimenting with fgetcsv() function #3

<?php
   $row=1;
   $num=0;
   $url = "http://~~~~~~~~~~/sample3.csv";
   $handle = fopen($url, "r"); 
     var_dump($handle); 
   while (($data = fgetcsv($handle, 100, ",")) !== FALSE) {
      $num = count($data);
      echo "<p> $num fields in line $row: <br /></p>\n";
      
      $row++;
      for ($c=0; $c < $num; $c++) {
         echo $data[$c] . "<br />\n";
      }
   }
   
   fclose($handle);
?>

No comments:

Post a Comment

MIT 6.00 コンピュータサイエンスとプログラミング秋期講座第2回

  MIT 6.00 コンピュータサイエンスとプログラミング秋期講座第2回 オープンコースウエア 大学名:MIT 講座名:6.00 Introduction to Computer Science and Programming Download course material ...