IS 337: Website Administration
Lecture for November 26: Searching and Templating
Topics
Urlacher Shop
- Better way for me to handle different backends: different
includes! 
- Searching in PHP (with any backend) toggle
- Searching: toggle
array_search($needle, $haystack) is no good! 
array_filter($array, $callback) 
- roll your own
 
 
- Matching: toggle
strstr($haystack, $needle) (substring) 
- comparison operators
 
- regular expressions
 
 
 
- Searching in SQL (with SQL backend) toggle
- Better in SQL: optimized for sorting; SQL indexes
 
- Search: 
WHERE clause of SELECT 
- Matching: toggle
LIKE operator 
- comparison operators
 
- regular expressions (some DBMSs)
 
 
 
- Injections toggle
- XML injection? No.
 
- SQL injection? YES!!!
 
- Regex injection? Not in SQL, YES IN PHP!!!!!
 
 
- Search form toggle
q is a common name for the field (thank you,
Google!) 
- Note value of text field.
 
 
- Should... toggle
- ...iterate through cart (not inventory) to compute
checkout!!!!
 
- ...combine search and sort.
 
- ...have individual product pages.
 
- ...have existing quantities in shopping page.
 
 
NetBeans Is
Cool
  
Quick Written Assignment for Next Time
Write a PHP function to compare the costs of two items.