Archive for the ‘MySQL Programming’ Category

Building A Searchable eCommerce Web Database with PHP and MySQL

Wednesday, May 7th, 2008

At the root of a successful eCommerce web site design is a searchable MySQL Database powered by PHP. Unless you only sell a few items that never change, you can expect your inventory to grow, require regular changes and additions, and keep you on your toes. It’s a whole different story from a point of Sale POS approach, although they can communicate together and operate as a single system using a single resource, if needed. If your eCommerce Database is hosted on your web server somewhere, it’s ging to require administration via the Internet, and that presents some issues for development as well as ongoing maintenance. (more…)

How To Send Data From Flash To ASP/PHP Without A Page Refresh

Thursday, November 29th, 2007

This article will deal the how to of sending form data from Adobe Flash to your PHP/ASP file so it can be inserted into a database (or manipulated for whatever other reason). The trick is making sure a new window doesn’t popup and the page doesn’t refresh to run through the ASP/PHP code. That’s the one issue I’ve noticed with some downloadable example of contact or email form examples. A new window pops up and often says, Thanks for the email! I’ll give a really bare-bones example where no new windows popup and the window containing your Flash isn’t refresh. This articles example will show an example done in ASP, but this will work with any other programming language.

NOTE: This is not for beginners.

Components

  • Flash File
  • HTML with Flash File
  • ASP/PHP/etc Page That Will Process Form Data
  • HTML page with Frames.

Concept

What we’re going to do is set up a Flash File that will simply send form data to an ASP file. Our HTML page with frames will have two frames. One frame will contain the HTML with our Flash, the second will contain a sandbox that will allow the ASP file to refresh without ever affecting the main page we’re browsing. We’re going to hide the second frame so that we don’t ever see the refreshes happening.

I know what you’re thinking, frames are lame. In our example though, you won’t even notice it being there.

Flash File

Create a new Flash file, select the first blank frame you’re given, bring up the ActionScript window and copy and paste the following code:

stop();
varsToSend = new LoadVars();
varsToSend.firstVar=”Pat-Burt”;
varsToSend.send(”intoDatabase.asp”,”process”,”POST”);

Explanation
stop - makes sure that your Flash movie doesn’t loop and constantly send “Pat-Burt” to your ASP file.
varsToSend - our LoadVars() object that contains all the variables we’ll be sending to our ASP file.
firstVar - a variable, you can have any number of these.
send - sends the vars in varsToSend to intoDatabase.asp
process - the frame name (we’ll use this later)
post - how we’re sending the data to the database

HTML Frame Page

Create a new HTML page, strip the body tags and throw this in:

<FRAMESET rows=”100%, 1″ >
<FRAME src=”flash.html” name=”flash” noresize frameborder=”0″>
<FRAME src=”
intoDatabase.asp” name=”process” noresize scrolling=”no” frameborder=”0″>
</FRAMESET>

Explanation
Frameset - creates the frames, defines the first to have 100% height, and the second to have a height of 1 pixel.
flash.html - Our HTML file with our Flash file inserted. It is named “flash”.
process.html - Our HTML file where our ASP file will be reloaded to insert data into the database. It’s located in the frame sized as 1 pixel.

ASP File

This is the simplest version I could present. Keep in mind you will need to define db which should reference your connection string to your database.

db.execute(”INSERT INTO database (message) VALUES (’”&request.form(”firstVar”)&”‘)” )

Explanation
request.form(”firstVar”) - the name of the variable in our Flash file
database - our database name
message - the column name in our database

HTML with Flash File

Insert your Flash file in whatever form you prefer. I recommend SWFObject.

Put Them All Together And Make Sure You…

  • Name the HTML file with your Flash: flash.html
  • Name your ASP file (in this example) to intoDatabase.asp
  • Provide a <noframes /> alternative where the page is loaded in a new window in the off chance someone has frames turned off
  • Don’t get to complicated. Get everything working in its simplest form before you add extra features

Good luck, hope that helps. By Patrick Burt

Automating Image Uploads And MySQL Database Tracking

Saturday, October 6th, 2007

These days everyone wants to upload their images to a web application. Whether it’s a free public site like Photobucket, or an eCommerce Web Site like Shutterstock or Flickr, the concepts are the same. The intent is to provide a system for web users with no web programming skills, which lets them upload a single file, and do nothing else. The result is the automated manipulation of image uploads into thumbnails, various intermediate sizes, perhaps retaining the original image upload, and tracking all components with a MySQL Database. (more…)

Prevent SQL Injections by Using PHP Programming and MySQL Programming

Thursday, July 19th, 2007

Web applications that utilize back-end databases are potentially vulnerable to the common SQL Injection. By submitting a segment of database code through the form, the PHP Program’s MySQL commands might be modified or enhanced for no good. Consider a typical contact form that receives an email address with a single field. The intent is to make receipt of the user’s email address using a PHP Program and insert it into a Newsletters Database. Let’s discuss  how  SQL Injection is performed and prevented… (more…)

Website Scanners and MyQSL Database Reconstruction With PHP

Saturday, April 28th, 2007

The content found in websites can be collected, filtered, and reconstituted in a MySQL Database with total automation with PHP. When a website is database driven, such as a retail website, the format of the displayed information is predictable and often, the pathway structures are also predictable. The construction of such website scanners for reconstructing web content or web databases in a local website and MySQL Database requires PHP expertise in irregular string pattern matching, string handling, methods of string filtration, and basic MySQL Database connectivity. (more…)

General DBM and PHP Database Management Systems

Sunday, April 8th, 2007

Database Management has become a critical component for any eCommerce Web Site that is managed by the store operators or owners. The ability to create, edit and delete inventory can be an everyday operation. Managing product photographs, prices, and descriptions can be a time consuming task and is best left in the hands of the people who normally handle that inventory. Rather than pass regular update requests to the webmaster or database programmer, PHP Database Management Systems provide the necessary tools to handle every aspect of inventory management through intuitive and simple PHP web interfaces. More programming and back end development offers a simpler and more effective experience for the PHP web site administrator. Less programming leads to frustrating experiences with confusing and buggy systems.

The many routine tasks for managing PHP eCommerce Website Inventory include
· Changing Retail and Sale Prices
· Changing Names and Description
· Adding and Changing Product Photographs
· Configuring Tax, Shipping & Handling, and Other Rates
· Configuring Admin and Member Permissions
· Managing Administrators
· Managing Website Members
· Analyzing Sales and Generating Reports
· Analyzing Traffic and Generating Reports
· Tracking Deliveries and Generating Reports

Combinations of Javascript, AJAX, PHP, and MySQL may be employed to enhance all PHP programs to provide a more efficient admin and user experience. Form validation with standard Javascript can prevent incomplete form submissions. AJAX can make form validation and page manipulation real time. Client-side validation and content manipulation can be applied to much more than form validation, and should be used in all systems where the long term time savings for the admin warrants additional programming time. Economic feasibility must be considered before any system enhancement.

PHP and MySQL programming should perform server-side data cleansing and data validation regardless of client-side form validation. Error messaging should be concise and informative. Data handling and backup redundancies are more important as the product value and business cash flow increase. For example, the web server may store requests in the database, but should additionally write flat file backups and/or deliver data sets via email to the store manager. Scheduled database and file system backups should be performed both locally and remotely.

Product photo uploads should be handled and manipulated such that the store admin need nothing more than the original photo. Although file sizes can be a limiting factor on different PHP web servers, the INI file can be modified to accommodate or th admin can simply shoot lower resolution digital photos. The photo upload should recognize the dimensions and aspect ratio so that new sizes can be created on the fly. The original upload should be stored for update systems to work with at a later date. Large, medium, small, and thumb sized web-ready images should all be generated at the time of upload. They should be tagged and tracked by the database in association with the product record. Textual overlays (name and domain) and graphical watermarking (company logo) should be applied to some or all of the generated photos. Image storage should be managed by the PHP server and correct file system permissions handling should be configured correctly.

Data manipulation by PHP can save a lot of time for the admin. Percentages and other calculations of data entry can be defined and configured by and through PHP. For example, each product record may have a Wholesale Price, Retail Price, Sale Price, and Liquidation Price. Rather than requiring the admin to select which price is to be applied, a series of PHP checks can be programmed into the system. Wholesale Prices are obviously kept private and used only for reporting systems. Retail Prices are the default value displayed to the shopper. If the Sale Price is given a value, it may cause the Retail Price to be “lined through” to indicate it has been “slashed” for the Sale Price. If the Liquidation Price is given a value, the Sale Price may also be lined through. Additionally, the presence of these values may provide modified search results, allowing the shopper to search for all Sale Items or limit results to Liquidation Items. Reporting systems can calculate the value of the inventory on hand, and calculate the potential return based on current pricing configurations. Going a step beyond this, PHP can calculate the quantities on hand for all items and compare against the age of that inventory and the potential returns based on Retail, Sale and Liquidation prices. The generated report could create a suggested target list of items to consider for Sale and Liquidation from Best Picks down to the items that should be left at Retail.

Regardless of which systems are utilized in the PHP Web Site or eCommerce Web Site, they should use good PHP Programming and be restricted to cost efficient use of the PHP Programmer’s time. A healthy balance between aesthetic administration interfaces and the efficiency of usage is very important. The multi-variable multi-dimensional dynamics of database management systems should be crafted to meet the needs of the business, to create positive cash flow, and provide an easy and efficient experience for the site administrator.


Need a web and database programmer? Contact The PHP Kemist

eCommerce Web Site Design | PHP Web Programmers | Website Development & Search Engine Optimization
Network Security Programmers | Shopping Carts For eCommerce | Internet & Search Engine Marketing
Salt Lake City Utah Website Design | Bay Area California Website Design | San Jose California Website Design