|
|
|
Let’s face it, no one is going to be a repeat visitor to your website unless you are providing them with something new and valuable each time they visit. In order to do this, you are going to have to create a dynamic website that is constantly changing to keep these repeat visitors or customers interested. This can be a lot of work for a website owner if they have to constantly modify their web pages with new information for the visitors. An easy solution to this is to create a dynamic site using PHP and MySQL that will change parts of your site for you.
A great example in which this technique is very successful is on an online store where visitors can purchase products. You will be able to get more products seen by visitors if you use PHP and MySQL to rotate the listed items on the main page each time someone visits your website.
The first thing that you need to do is create a database that will list the various products that you would like to display on the page. If you do not know how to do this in MySQL, there are many different tutorials that can be found online to get you started. When creating your database, you will need to have two different fields for each item. The first is an identifying number and the second is the field that will hold the product’s description and details. You can also add additional fields for a picture or other things.
Now that you have created a database with the items you want to rotate on your website, you will need to devise a technique to determine which of these items will be shown. A common technique is to use a random number generator. In order to do this you will need to know how many different items there are to choose from and then enter the starting and ending number in a variable to hold the number and then use the rand command to generate a number within this range.
Once you have created a number to indicate which item you would like to display on your web page, you can access the information to display by using the $query_content command. For more details, check out tutorials found online. Now each time your website loads, the code will randomly select an item from your database to be displayed to the website visitor. This is great for retail websites because if an item did not interest them the first time they came to your website, a different item might next time.
One thing to be careful of when creating the items in your database is to set a specific size for each item. This will help to ensure that when each item is displayed it will fit on your website in the same way as the previous one to help prevent you from running into formatting problems on the site. If you do not do this, you will risk looking unprofessional, which is sure to make some visitors to your website leave.
Looking for the 10 best, most reliable and affordable web hosting companies
reviewed by experienced webmasters click here.
|