Determine a visitor's location by their IP address!
Tracking a visitor's geographical location (ie. country, region, city, latitude, longitude, ZIP code, ISP and domain name) used to be a cool trick. Now it is an integral part of many websites, enabling them to identify the locations from where they're getting the maximum traffic; and tune your webpages accordingly. It also enables you to modify the site according to location, or send users to...
Build a search query with relevance in PHP & MySQL
Do you have a lot of content or data from your website in a MySQL database, but no search feature to surface it? This is a simple function that performs searches better than just using the LIKE operator in your SELECT statement. This is a handy function that takes that name of the table that you want to search, the number of words in the...
A Simple Login System with PHP & MySQL
Essential to any membership-based site is a long system. This code will provide you with the basis from which to start.
How to Remove Foreign Keys in MySQL
I ran into a situation a while back, where I'd designed a MySQL databses in InnoDB format on a test server, and implemented foreign key constraints with cascaded updates and deletes. However, when I uploaded the database to my web host the whole thing just crashed. Apparently the host didn't support InnoDB format, and therefore didn't support foreign keys. Here's how I fixed it.
Create Foreign Keys in MySQL
If you're using/controlling MySQL from a GUI tool, you may have the ability to easily add foreign key constraints. However, if you have to use the command prompt, here's the SQL statement code to manually add a foreign key constraint.