How to use a local fallback in the event a CDN isn’t available for jQuery

Worried about using a CDN?

  • Worried about a CDN being down?
  • Concerned a CDN might slow your site down?
  • Thinking there must be a down side to accessing files from a CDN?

Fear not a CDN (Content Delivery Network) is a globally distributed network of servers deployed in many data centers. Giving you several advantages:

  • A CDN is unlikely to be down, after all, up time is one of the big selling points of CDN.
  • Decreased latency so that a user accessing your site will be able to download the content faster
  • Increased parallel connections can be made. Again increasing the speed your content and site can download to a users browser
  • Cross-site caching if other sites your users have visited also use the same CDN. jQuery may already be cached in their browser

If that hasn’t allayed your fears? Then you can always use a fallback for a local version of jQuery like this:

If you found this post useful, please subscribe below. If you have any questions, don’t hesitate to leave a comment…

How to join two MySQL database tables together in a simple SELECT statement

How to join two MySQL database tables together in a simple SELECT statement?
For example I have a table of products and a table of product categories, how to return the category description of each product?
Products
———–
id
category_id
product_name

Categories
————-
id
description

A. In it’s simplest form you would join two tables based on the relationship between a key and it’s foreign key stored in another table:
SELECT p.id, p.product_name, c.description AS ‘cat_description’
FROM products p
INNER JOIN categories c on p.category_id = c.id

Using a well designed relational database and JOINed queries will make your PHP code simpler and more efficient by returning the data from two or more tables in one query.

Like this post? please leave a comment below: