Web Development with PHP and MySQLDynamic, database-driven small business web sites done right.
|
| Web Developer :: phpMyEdit :: MySQL Cheat Sheet :: Clients |
|
|
Why use PHP and MySQL?PHP scripting and MySQL database enables programmers to create applications that'll run on just about any computer, regardless of operating system. PHP has thousands of programming functions to facilitate almost any task. If the computer can run web server software, the PHP / MySQL™ application is portable across operating systems and environments ... PC, Mac, Linux, Unix, Windows, Lindows, Internet, Intranet, etc. This means I can develop a project on my Windows PC, and send it to my friend in Slovakia who can run it on his Linux box. PHP / MySQL™ is most often used to create dynamic web sites. On this web site, one script drives about 60 pages of content. Additional scripts are used here to process form data ... but that too could be done through the main script using included files. PHP / MySQL™ projects include forums or communities, organizers, project management tools, calendars, shopping carts, mailing lists, and all sorts of useful applications. Source code for many open source projects is free, while advanced projects often require a registration fee for commercial use. Data can be exported from MySQL™ for use in spreadsheets or databases on your PC. Similarly, data residing in existing PC spreadsheets and databases can be imported to an online database. The portability of data opens up all sorts of uses, especially for workgroups and for those who need to access data from both home and work. Tips for using PHP with MySQLNever use a hyphen (-) in the name of a MySQL™ database, table, or column name. Doing so will eventually come back to haunt you. Generally speaking, name your variables and MySQL™ components using lower case alphanumeric characters and the underscore (_) character. Variable names and MySQL™ components should begin with a letter, not a number. Creating MySQL™ column names such as "first_name" instead of "FirstName" will enhance readability and facilitate replacing the underscore character with a space when displaying column names. Do not use PHP / MySQL™ reserved keywords as the name of a PHP variable or a MySQL™ database, table, or column. The use of reserved words is likely to cause unexpected results, and cause you (or someone else) to waste a lot of time trying to track down the problem. Learn to use the define() function in order to create variables that will become global in scope (automatically available within user defined functions). Consider creating variable names that can subsequently and easily be declared as global within user defined functions (as an array) by using a syntax such as: $opts = array();or $data = array(); Do not use short PHP tags (<? echo 'hello world'; ?>) because if the scripts are subsequently transferred to a server where short tags are turned off in the php.ini file, the scripts will not run. Before purchasing PHP projects, request code samples from the project. You may decide not to consummate the purchase if short tags are present, or if the coding style does not conform to good practices such as PEAR Coding Standard, or if the variables code are often double-quoted. Such findings may indicate the developer is not highly skilled. Buyer beware. Saving PHP scripts or "include files" using the filename extension ".inc" will result in the server displaying that file as if it were a text file (if requested directly by the web browser). Consequences can be significant if you were to expose your database logon inside something like "db_logon.inc". Consider placing all your "include files" above the root directory of the web site, or in a sub-directory that has been password protected. If you are not in control of the server, and if your "include files" are above the root folder, and if your web host changes the path to root during a system upgrade, the "include files" will not be at the expected location (your project will crash). Most web hosts provide a control panel with a Password Protection utility that makes it easy to apply password protection to a sub-directory. Sessions are impacted by the PHP version as well as the register_globals setting in PHP.INI. If you find that a project using sessions behaves differently on different servers, investigate the impact of the register_globals setting. In general, security is enhanced when register_globals are set to OFF. Uniform ServerUniform Server is free, portable, open source WAMP package for Microsoft Windows (Apache, MySQL, PHP, Perl, phpMyAdmin, etc.) which can be installed on a USB drive, a hard drive, smartmedia card, etc. Uniform Server has an installer and it works great! No muss, no fuss. I migrated a content management system to a portable USB Flash Drive in 10 minutes ... the only scripts that I needed to change were a few PHP scripts that expected a document root of C:/apache/htdocs instead of Uniform Server's document root of W:/www. If you already have Apache and MySQL running as a service under Windows, simply shut down those services before (for example) firing up Uniform Server on a USB stick.
|
|
copyright © 2010 - hockinson.com - all rights reserved -
home
- top
web designer - web designer - colorado web developer - web hosting - mysql form maker |