- $db = new mysqli(...);
- check bd connection error? mysqli_connect_errno()
- connection ok, $db->real_escape_string()
- $db->query(); ex: $result = $db->query()
- if the query "SELECT", $result->num_rows;
- if "UPDATE / INSERT", $db->affected_rows;
- make a loop to retrieve data from db [for / while] 0 to num_rows-1
- $row = $result->fetch_assoc();
- get the db data ex: $row['id'], $row['name']
- $result->free();
- $db->close();
Day 27:
- update
- encryption, date & time Function in MySQL
- prevent SQL injection : preparedStatement
- bind_param variables -i, d, s, b
- $db = new mysqli(...);
- check bd connection error? mysqli_connect_errno()
- ex: $query = "select name from books where isbn=?"; //value replace to ? in query
- $db->prepare(); ex: $stmt = $db->prepare($query);
- $stmt->bind_param('s', $isbn); //if 1 ? then, parameter type 's' refer to its type, and the $isbn refer to the value of the ?
- if the query "SELECT", $stmt->bind_result($name);
- $stmt->execute();
- if the query "SELECT", $stmt->store_result();
- if the query "SELECT", $stmt->num_rows;
- if "UPDATE / INSERT", $stmt->affected_rows;
- make a loop to retrieve data from db using while : $stmt->fetch()
- get the db data ex: $name // as what the parameter we keep for bind_result
- $stmt->free_result();
- $stmt->close();
- $db->close();
Day 28:
- [txtbk Chapter 17] Implement Authentication with PHP & MySQL
- [txtbk Chapter 23] Using Session Control
Day 29:
- [txtbk Chapter 27] Building User Authentication and Personalization
- ispell dictionary ->select English -> download collection of word
lists for spell-checking
download Ispell English Word Lists .zip
- [txtbk Chapter 34] Web 2.0 Applications with Ajax
- step to change chapter 27 codes to be ajax :--
- insert new_ss.css and new_ajax.js to project chapter27
- amend function display_add_bm_form() in output_fns.php
- amend do_html_header() in output_fns.php
- link external js and css
- modify add_bms.php
- remove --- do_html_header('Adding bookmarks');
- remove --- display_user_menu();
- remove --- do_html_footer();
- remove --- check_valid_user();
- remove --- try block and exception handling to something make sense in ajax environment
- add else(s)
- modify url_fns.php
- in function add_bm() : throw change to echo(s); add else; remove --- return true;
Day 30:
- [txtbk Chapter 28] Building a Shopping Cart
1. Name the functions of MySql that encrypts string.
ReplyDeleteENCRYPT()
MySQL AES_ENCRYPT()
MySQL DES_ENCRYPT()
MySQL MD5()
MySQL password()
FROM guna
ReplyDeleteCRYPT()
UNCOMPRESSED_LENGTH()
UNCOMPRESS()
DES_ENCRYPT()
OLD_PASSWORD()
ENCRYPT()
ENCODE()
SHA1(), SHA()
thanks for trying.
ReplyDeleteFor all : check this out: https://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html
Cheers