PHP and MySQL Server-Side Web Languages

ODBC. PHP / MySQL. Security. PHP and MySQL. Server-Side Web languages … ODBC. PHP / MySQL. Security. Cursors. ► A pointer to the current item in a query ….

More PDF Content

PHP and MySQL Server-Side Web Languages
Outline
ODBC
PHP/MySQL
Security
Managing user data (logins and passwords)
E-commerce, shopping carts
Search engine data and other repositories
Embedded SQL
SQL can be embedded within procedural programming languages.
These languages include C/C++, Java, Perl, Python, and PHP.
Embedded SQL supports:
Highly customised applications.
Background applications running without user intervention.
Combining database tools with programming tools.
Databases on the WWW.
SQL and program compiled into a single executable.
Very efficient link.
ODBC – Open Database Connectivity (eg. PHP/Java):
SQL query sent from the program to the database as a string.
Results returned as an array or list.
Independence of program and database:
Each language has one DBI (database interface) for all DBMS types. (For example, JDBC for Java.)
Separate database drivers (DBD) for each DBMS type.
Cursors
A pointer to the current item in a query result set.
Starts with the first item.
Steps through the results one at a time.
Some cursor implementations allow to step back up as well.
ODBC database connections
Connect to the database.
Prepare a query (as a string).
Execute the query.
Fetch the results (as an array of rows).
Finish the query (so that DB can clean up its buffers).
Disconnect from the database.
Security Warning!
Using MySQL and PHP on the web is a potential severe security risk.
There is a lot of nonsense information about how to use MySQL with PHP on the web.
It is especially dangerous to take any user input (i.e. form variables) and use them directly in an SQL query.
For an experienced programmer, PHP provides a lot of support for writing secure code (but that is beyond this lecture).
Inexperienced programmers should not use MySQL with PHP.

Download PHP and MySQL Server-Side Web Languages pdf from www.upriss.org.uk, 12 pages, 101.36KB.
Related Books

Leave a Reply