Tài liệu về học lập trình web bằng ngôn ngữ PHP cho tất cả mọi người.
[...]... ('name' => 'Stephen', 'grade' => 94.0), 364 => array ('name' => 'Steve', 'grade' => 85. 1), 68 => array ('name' => 'Rob', 'grade' => 74.6) ); Multidimensional Arrays 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 // Name sorting function: function name_sort ($x, $y) { return strcasecmp($x['name'],... ($parent_id, '$task')"; $r = mysqli_query($dbc, $q); // Report on the results: if (mysqli_affected_rows($dbc) == 1) { Advanced PHP Techniques Script 1.2 continued 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 } // End of submission IF // Display the form: echo ' Add a Task Task: array (‘name’ => ‘Jon’, ➝ ‘grade’ => 98 .5) , 2 => array (‘name’ => ‘Vance’, ➝ ‘grade’ => 85. 1), 9 => array (‘name’ => ‘Stephen’, ➝ ‘grade’ => 94.0), 364 => array (‘name’ => ‘Steve’, ➝ ‘grade’ => 85. 1), 68 => array (‘name’ => ‘Rob’, ➝ ‘grade’ => 74.6) ); The... My definition of advanced PHP programming covers three loosely grouped skills: ◆ Doing what you already do better, faster, and more securely ◆ Learning more sophisticated PHP techniques ◆ Doing standard things using PHP and other technologies (like PEAR, Ajax, or OOP) This book can be divided into three sections, corresponding to those skills The first five chapters cover advanced PHP knowledge in... xhtml1-transitional.dtd”> < ?php # Script 1.2 - add_task .php continues on page 14 Multidimensional Arrays Script 1.2 Tasks are added to the database using this script Tasks can even be filed under other tasks using the drop-down menu 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 12... instead If you have read the PHP and MySQL book, or the first edition of this one, I’m hoping that you’ll find this to be a wonderful addition to your library and skill set xii Introduction About PHP 5 Although version 5 of PHP has been out since July 2004 (when the first non-beta version was released), there are still a large number of servers running older versions of PHP, particularly outside of... < ?php # Script 1.1 - sort .php /* * * * */ This page creates a multidimensional array of names and grades The array is then sorted twice: once by name and once by grade // Create the array: // Array structure: // studentID => array ('name' => 'Name', 'grade' => XX.X) $students = array ( 256 => array ('name' => 'Jon', 'grade' => 98 .5) , 2 => array ('name' => 'Vance', 'grade' => 85. 1), 9 => array... ORDER BY date_added ASC'; $r = mysqli_query($dbc, $q); // Also store the tasks in an array for use later: $tasks = array(); Multidimensional Arrays 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 echo 'The task has been added!'; } else { echo 'The task could not be added!'; } while (list($task_id, $parent_id, $task) = . GUIDE PHP 5 A DVANCED Larry Ullman Peachpit Press Visual QuickPro Guide PHP 5 Advanced Larry Ullman Peachpit Press 1249 Eighth Street Berkeley, CA 94710 51 0 /52 4-2178 51 0 /52 4-2221. 94710 51 0 /52 4-2178 51 0 /52 4-2221 (fax) Find us on the Web at: www .peachpit. com To report errors, please send a note to: errata @peachpit. com Peachpit Press is