SlideShare a Scribd company logo
CakePHP2


 CakePHP Yusuke Ando (@yando)
          Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
by crabchick




CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
<?php
$keyword = '';
if (isset($_POST['keyword'])) {
       $keyword = $_POST['keyword'];
}


mysql_connect('localhost','user','password');
mysql_select_db('cakephp_sample');
mysql_query('set names utf8');
$sql = sprintf(
     "SELECT id,name,description FROM friends WHERE name LIKE '%s'",
     mysql_real_escape_string('%'.$keyword.'%')
);
$result = mysql_query($sql);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
     $data[] = $row;
}
?>
<html>
<head><title>               </title></head>
<body>
<form action="list1.php" method="POST">
<input name="keyword"><input type="submit">
</form>
<ul>
<?php
foreach ($data as $row) {
       echo '<li>';
       echo $row['name'];
       echo $row['description'];
       echo '</li>';
}
?></ul>
</body></html>




         CakePHP                   Yusuke Ando (@yando)
<?php
$keyword = '';
if (isset($_POST['keyword'])) {
       $keyword = $_POST['keyword'];
}


mysql_connect('localhost','user','password');
mysql_select_db('cakephp_sample');
mysql_query('set names utf8');
$sql = sprintf(
     "SELECT id,name,description FROM friends WHERE name LIKE '%s'",
     mysql_real_escape_string('%'.$keyword.'%')
);
$result = mysql_query($sql);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
     $data[] = $row;
}
?>
<html>
<head><title>               </title></head>
<body>
<form action="list1.php" method="POST">
<input name="keyword"><input type="submit">
</form>
<ul>
<?php
foreach ($data as $row) {
       echo '<li>';
       echo $row['name'];
       echo $row['description'];
       echo '</li>';
}
?></ul>
</body></html>




         CakePHP                   Yusuke Ando (@yando)
<?php
                                               //model.php
                                               mysql_connect('localhost','user','password');
                                               mysql_select_db('cakephp_sample');
                                               mysql_query('set names utf8');
                                               $sql = sprintf(
                                                    "SELECT id,name,description FROM friends WHERE name LIKE '%s'",
                                                    mysql_real_escape_string('%'.$keyword.'%')
                                               );
                                               $result = mysql_query($sql);
                                               $data = array();
                                               while ($row = mysql_fetch_assoc($result)) {
<?php
                                                    $data[] = $row;
//index.php
                                               }
$keyword = '';
if (isset($_POST['keyword'])) {
    $keyword = $_POST['keyword'];
}

                                               <!-- view.php -->
include ‘model.php’;                           <html>
include ‘view.php’;                            <head><title>               </title></head>
                                               <body>
                                               <form action="list1.php" method="POST">
                                               <input name="keyword"><input type="submit">
                                               </form>
                                               <ul>
                                               <?php
                                               foreach ($data as $row) {
                                                      echo '<li>';
                                                      echo $row['name'];
                                                      echo $row['description'];
                                                      echo '</li>';
                                               }
                                               ?></ul>
                                               </body></html>




                                    CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
/**
  * To configure CakePHP *not* to use mod_rewrite and to
  * use CakePHP pretty URLs, remove these .htaccess
  * files:
  *
  * /.htaccess
  * /app/.htaccess
  * /app/webroot/.htaccess
  *
  * And uncomment the App.baseUrl below:
  */
	     //Configure::write('App.baseUrl', env('SCRIPT_NAME'));




                CakePHP       Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)
CakePHP   Yusuke Ando (@yando)

More Related Content

8時間耐久CakePHP2 勉強会

  • 1. CakePHP2 CakePHP Yusuke Ando (@yando) Yusuke Ando (@yando)
  • 2. CakePHP Yusuke Ando (@yando)
  • 3. CakePHP Yusuke Ando (@yando)
  • 4. CakePHP Yusuke Ando (@yando)
  • 5. by crabchick CakePHP Yusuke Ando (@yando)
  • 6. CakePHP Yusuke Ando (@yando)
  • 7. CakePHP Yusuke Ando (@yando)
  • 8. CakePHP Yusuke Ando (@yando)
  • 9. CakePHP Yusuke Ando (@yando)
  • 10. CakePHP Yusuke Ando (@yando)
  • 11. <?php $keyword = ''; if (isset($_POST['keyword'])) { $keyword = $_POST['keyword']; } mysql_connect('localhost','user','password'); mysql_select_db('cakephp_sample'); mysql_query('set names utf8'); $sql = sprintf( "SELECT id,name,description FROM friends WHERE name LIKE '%s'", mysql_real_escape_string('%'.$keyword.'%') ); $result = mysql_query($sql); $data = array(); while ($row = mysql_fetch_assoc($result)) { $data[] = $row; } ?> <html> <head><title> </title></head> <body> <form action="list1.php" method="POST"> <input name="keyword"><input type="submit"> </form> <ul> <?php foreach ($data as $row) { echo '<li>'; echo $row['name']; echo $row['description']; echo '</li>'; } ?></ul> </body></html> CakePHP Yusuke Ando (@yando)
  • 12. <?php $keyword = ''; if (isset($_POST['keyword'])) { $keyword = $_POST['keyword']; } mysql_connect('localhost','user','password'); mysql_select_db('cakephp_sample'); mysql_query('set names utf8'); $sql = sprintf( "SELECT id,name,description FROM friends WHERE name LIKE '%s'", mysql_real_escape_string('%'.$keyword.'%') ); $result = mysql_query($sql); $data = array(); while ($row = mysql_fetch_assoc($result)) { $data[] = $row; } ?> <html> <head><title> </title></head> <body> <form action="list1.php" method="POST"> <input name="keyword"><input type="submit"> </form> <ul> <?php foreach ($data as $row) { echo '<li>'; echo $row['name']; echo $row['description']; echo '</li>'; } ?></ul> </body></html> CakePHP Yusuke Ando (@yando)
  • 13. <?php //model.php mysql_connect('localhost','user','password'); mysql_select_db('cakephp_sample'); mysql_query('set names utf8'); $sql = sprintf( "SELECT id,name,description FROM friends WHERE name LIKE '%s'", mysql_real_escape_string('%'.$keyword.'%') ); $result = mysql_query($sql); $data = array(); while ($row = mysql_fetch_assoc($result)) { <?php $data[] = $row; //index.php } $keyword = ''; if (isset($_POST['keyword'])) { $keyword = $_POST['keyword']; } <!-- view.php --> include ‘model.php’; <html> include ‘view.php’; <head><title> </title></head> <body> <form action="list1.php" method="POST"> <input name="keyword"><input type="submit"> </form> <ul> <?php foreach ($data as $row) { echo '<li>'; echo $row['name']; echo $row['description']; echo '</li>'; } ?></ul> </body></html> CakePHP Yusuke Ando (@yando)
  • 14. CakePHP Yusuke Ando (@yando)
  • 15. CakePHP Yusuke Ando (@yando)
  • 16. CakePHP Yusuke Ando (@yando)
  • 17. CakePHP Yusuke Ando (@yando)
  • 18. CakePHP Yusuke Ando (@yando)
  • 19. CakePHP Yusuke Ando (@yando)
  • 20. CakePHP Yusuke Ando (@yando)
  • 21. /** * To configure CakePHP *not* to use mod_rewrite and to * use CakePHP pretty URLs, remove these .htaccess * files: * * /.htaccess * /app/.htaccess * /app/webroot/.htaccess * * And uncomment the App.baseUrl below: */ //Configure::write('App.baseUrl', env('SCRIPT_NAME')); CakePHP Yusuke Ando (@yando)
  • 22. CakePHP Yusuke Ando (@yando)
  • 23. CakePHP Yusuke Ando (@yando)
  • 24. CakePHP Yusuke Ando (@yando)
  • 25. CakePHP Yusuke Ando (@yando)
  • 26. CakePHP Yusuke Ando (@yando)
  • 27. CakePHP Yusuke Ando (@yando)
  • 28. CakePHP Yusuke Ando (@yando)
  • 29. CakePHP Yusuke Ando (@yando)
  • 30. CakePHP Yusuke Ando (@yando)
  • 31. CakePHP Yusuke Ando (@yando)
  • 32. CakePHP Yusuke Ando (@yando)
  • 33. CakePHP Yusuke Ando (@yando)
  • 34. CakePHP Yusuke Ando (@yando)
  • 35. CakePHP Yusuke Ando (@yando)
  • 36. CakePHP Yusuke Ando (@yando)
  • 37. CakePHP Yusuke Ando (@yando)
  • 38. CakePHP Yusuke Ando (@yando)
  • 39. CakePHP Yusuke Ando (@yando)
  • 40. CakePHP Yusuke Ando (@yando)
  • 41. CakePHP Yusuke Ando (@yando)
  • 42. CakePHP Yusuke Ando (@yando)
  • 43. CakePHP Yusuke Ando (@yando)
  • 44. CakePHP Yusuke Ando (@yando)
  • 45. CakePHP Yusuke Ando (@yando)
  • 46. CakePHP Yusuke Ando (@yando)
  • 47. CakePHP Yusuke Ando (@yando)
  • 48. CakePHP Yusuke Ando (@yando)
  • 49. CakePHP Yusuke Ando (@yando)
  • 50. CakePHP Yusuke Ando (@yando)
  • 51. CakePHP Yusuke Ando (@yando)
  • 52. CakePHP Yusuke Ando (@yando)
  • 53. CakePHP Yusuke Ando (@yando)
  • 54. CakePHP Yusuke Ando (@yando)
  • 55. CakePHP Yusuke Ando (@yando)
  • 56. CakePHP Yusuke Ando (@yando)
  • 57. CakePHP Yusuke Ando (@yando)
  • 58. CakePHP Yusuke Ando (@yando)
  • 59. CakePHP Yusuke Ando (@yando)
  • 60. CakePHP Yusuke Ando (@yando)
  • 61. CakePHP Yusuke Ando (@yando)
  • 62. CakePHP Yusuke Ando (@yando)
  • 63. CakePHP Yusuke Ando (@yando)
  • 64. CakePHP Yusuke Ando (@yando)
  • 65. CakePHP Yusuke Ando (@yando)
  • 66. CakePHP Yusuke Ando (@yando)
  • 67. CakePHP Yusuke Ando (@yando)
  • 68. CakePHP Yusuke Ando (@yando)
  • 69. CakePHP Yusuke Ando (@yando)
  • 70. CakePHP Yusuke Ando (@yando)
  • 71. CakePHP Yusuke Ando (@yando)
  • 72. CakePHP Yusuke Ando (@yando)